title: modern for loop for primitive array
body: <p>Is there any performance difference between the for loops on a primitive array? </p>
  
  <p>Assume:</p>
  
  <pre><code>double[] doubleArray = new double[300000];
  
  
  for (double var: doubleArray) 
     someComplexCalculation(var);
  </code></pre>
  
  <p>or :</p>
  
  <pre><code>for ( int i = 0, y = doubleArray.length; i &lt; y; i++)
     someComplexCalculation(doubleArray[i]);
  </code></pre>
  
  <p><strong>Test result</strong></p>
  
  <p>I actually profiled it:</p>
  
  <pre><code>Total timeused for modern loop= 13269ms
  Total timeused for old loop   = 15370ms
  </code></pre>
  
  <p>So the modern loop actually runs faster, at least on my Mac OSX JVM 1.5. </p>