I came across this problem in class and I'm stuck on it. I did plenty of research but I'm not being able to fix my code.

I need to create a matrix and find the smallest value in the row of the largest value (I believe this element is called **minimax**). I'm trying to do with a simple 3 x 3 matrix. What I have so far:

```
    Scanner val = new Scanner(System.in);       
    int matrizVal[][] = new int[3][3];

    for (int a = 0; a < matrizVal.length; a++)      {
        for (int b = 0; b < matrizVal.length; b++)          {
            System.out.print("(" + a + ", " + b + "): ");
            matrizVal[a][b] = val.nextInt();    
        }
    }

    int largest = matrizVal[0][0];
    int largestrow = 0;
    int arr[] = new int[2];

    for (int row = 0; row < matrizVal.length; row++){
        for (int col = 0; col < matrizVal.length; col++){
            if (largest < matrizVal[row][col]){
                largest = matrizVal[row][col];
                largestrow = row;
            }
        }   
    }   

```

To find the so called minimax element I decided to create a for each loop and get all the values of largestrow except the largest one.

```
    for (int i : matrizVal[largestrow]){
        if (i != largest){
            System.out.print(i);
            }
        }

```

Here's where I'm stuck! I'd simply like to 'sort' this integer and take the first value and that'd be the minimax. I'm thinking about creating an array of size [matrizVal.length - 1], but not sure if it's gonna work.

I did a lot of research on the subject but nothing seems to help. Any tips are welcome.

(I don't think it is but I apologize if it's a duplicate)