title: Is iterating over columns in Java 2D arrays just as efficient as rows?
body: <p>Consider the following nested loops that iterate over the elements of each row in the array <code>arr</code>:</p>
  
  <pre><code>for(int i = 0; i &lt; arr.length; i++)
      for(int j; j &lt; arr[0].length; j++)
          //some code here involving arr[i][j]
  </code></pre>
  
  <p>Considering that Java does not have true "2D arrays" but rather only arrays of arrays, would this be as efficient as the following nested loops iterating over the columns of the array?</p>
  
  <pre><code>for(int j = 0; j &lt; arr[0].length; j++)
      for(int i = 0; i &lt; arr.length; i++)
          //some code involving arr[i][j]
  </code></pre>
  
  <p>Even though <code>arr[i][j]</code> is O(1), would I see any difference in the time it takes to do one solution over the other due to Java's implementation of 2D arrays?</p>