title: Array swap - 2d array
body: <p>I'm working on swapping indices in a two-dimensional array. I seem to be on the right track, but it's not swapping the array in the way I want.</p>
  
  <p>The first row's index <code>j</code> needs to be swapped with row 2's index <code>j</code>:</p>
  
  <pre><code>for (int j = 0; j &lt; array.length ; j++){  
       int temp = array[row1][j]
       array[row1][j]=array[j][row1]
       array[j][row1] = temp ;
  }
  </code></pre>
  
  <p>Any ideas on how to best approach this would be appreciated. </p>