title: calculate the minimum value for each column in 2D array
body: <p>I have a 2D array , iam trying to calculate the minimum value for each column and put the result in the result array.</p>
  
  <p>the code bellow is calculating the minimum value for each row , how  can i get the min value for each column.</p>
  
  <pre><code>        import java.util.*;
  
           class Test20 {
  
          public static void main ( String [] args) {
  
  
              int[][] array = {{6,3,9},
                               {0,8,2},
                               {3,7,5}};
  
  
  
             Test20 test = new Test20();
  
          System.out.print(Arrays.toString(test.mincol(array)));
        }
  
       public static int[] mincol (int[][] n) {
      int[] result = new int[n.length];
  
      for (int i = 0; i &lt; n.length; i++) {
  
          int min = n[0][i];
  
          for (int j = 0; j &lt; n[0].length; j++) {
  
              if (n[j][i] &lt; min) {
                  min = n[j][i];
              }
          }
          result[i] = min;
      }
      return result;
       }
     }
  </code></pre>