Strange code timing behavior in Java
<p>In the following code:</p>

<pre><code>long startingTime = System.nanoTime();
int max = (int) Math.pow(2, 19);
for(int i = 0; i &lt; max; ){
    i++;
}
long timePass = System.nanoTime() - startingTime;
System.out.println("Time pass " + timePass / 1000000F);
</code></pre>

<p>I am trying to calculate how much time it take to perform simple actions on my machine.</p>

<p>All the calculations up to the power of 19 increase the time it takes to run this code, but when I went above 19(up to max int value 31) I was amazed to discover that it have no effect on the time it takes.
It always shows 5 milliseconds on my machine!!!</p>

<p>How can this be?</p>
