title: method to do in place reversal of columns in a 2D array in Java
body: <p>The problem is given a <code>2D array</code> write a method to reversal of columns. If possible, do it <code>in-place</code>
  I have implemented and it works fine.but it is not <code>in-place</code>.It uses <code>auxillary storage</code>, is it possible to reverse columns of a 2D array without using matrix.</p>
  
  <pre><code>Here is my code:
  public static int[][] reverseColumns(int[][] matrix){
          int rows=matrix.length;
          int cols=matrix[0].length;
          int temp=0;
  
          int[][] result= new int[rows][cols];
  
          for (int row=rows-1; row &gt;=0; row--){
              for (int col=0;col&lt;cols;col++){
                  result[row][col]=matrix[temp][col];
              }
              temp++;
          }
          return result;
      }
  
    public static void print2DArray(int[][] result){
      for (int i=0; i &lt; result.length;i++){
          System.out.println(Arrays.toString(result[i]));
  
      }
  }
  
  public static void main(String[] args)
      {
          int[][] matrix = {
                  {1,2,3,4},
                  {5,6,7,8},
                  {9,10,11,12},
                  {13,14,15,16}
              int[][] result = reverseColumns(matrix);
      print2DArray(result);       
      System.out.println()
          };
  </code></pre>
  
  <p>output is :</p>
  
  <pre><code>[13, 14, 15, 16]
  [9, 10, 11, 12]
  [5, 6, 7, 8]
  [1, 2, 3, 4]
  </code></pre>