I've noticed that both of the following loops take the same amount of time: ~ 1.2 seconds.
double count = Math.pow(10, 9);
for (int i = 0; i < count; i++) {
int y = 10;
int x = 3*y;
x = 100*y;
int[] arr = new int[3];
arr[0] = 1;
}
double count = Math.pow(10, 9);
for (int i = 0; i < count; i++) {
//nothing
}
Why would they finish in the same time? These for-loops only increment and do 1 comparison, so 2 actions per iteration. I would think the first one would take about 3 times longer to finish, since it does 7 actions whereas the second one does 2.