title: Getting the minimum value of a column in a two-dimensional array
body: <p>I'm trying to find the minimum value in a 2D array(Java). </p>
  
  <p>I'm trying to use a for loop. My aim is to create a program that gets the saddle point of a matrix but I'm going step-by-step. I have figured out how to find the max value in a row of a 2D array. Then I want to find the min value IN the same column as the max value.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class Matrix_1 {
     int[][] A;
     int a;
     int b;
     int max;
     int min;
     int i;
     int d;
  
     Matrix_1() {
        super();
     }
  
     public int[][] createMatrix(int a, int b) {
        Scanner inputm = new Scanner(System.in);
        A = new int[a][b];
        System.out.println("Enter elements for matrix A : ");
        for (int i = 0; i &lt; A.length; i++) {
           System.out.println("Enter numbers for " + i + "th row");
           for (int j = 0; j &lt; A[i].length; j++) {
              A[i][j] = inputm.nextInt();
  
           }
  
        }
        return A;
     }
  
     public int[][] displayMatrix() {
        System.out.println("Matrix A: ");
  
        for (int i = 0; i &lt; A.length; i++) {
           System.out.println();
           for (int j = 0; j &lt; A[i].length; j++) {
              System.out.print(A[i][j] + " ");
           }
        }
  
        return A;
     }
  
     public int getMax(int c) {
        max = 0;
        a = c;
  
        for (i = 0; i &lt; A[a].length; i++) {
  
           while (A[a][i] &gt; max) {
              max = A[a][i];
           }
        }
  
        i = d;
        System.out.println(i);
        System.out.println("max = " + max);
        return max;
     }
  
     public int getMin() {
        max = min;
        a = 0;
  
        for (int j = 0; j &lt; A[a].length; j++) {
           while (A[i][j] &lt; min) {
              min = A[j][d];
           }
        }
  
        System.out.println("min in row " + a + "from max number" + max + " = "
              + min);
        return min;
     }
  }
  </code></pre>