```
import java.util.*
public class ArrayMinMax {
public static void main(String[] args)
{
Integer[] numbers={8,2,6,7,1,4,9,5,3};
int min=(int)Collections.min(Arrays.asList(numbers));
int max=(int)Collections.max(Arrays.asList(numbers));
System.out.println("Min number: "+min);
System.out.println("Max number: "+max);
}
}
```

Hi guys, me again.

Okay so I use this code in a single array if i want to know what the minimum and maximum numbers are. Now i'm trying to figure out how to implement the same program in a 2d array, with a 3x5 matrix and the user has to input the columns.

```
import javax.swing.*;
import java.util.*;
public class CMPROG2threeXfive{
public static void main(String[] args){
int[][] matrix=new int[3][5];
for(int row=0;row<matrix.length;row++){
for(int col=0;col<matrix[row].length;col++)
matrix[row][col]=Integer.parseInt(JOptionPane.showInputDialog
("Enter 15 integers for the 3x5 matrix:"));
}
}
}
```

and that's what i've come up with for the code of the 3x5 matrix. i'm not sure if i have to use another nested for loops for the min and max counting. any help would be very much appreciated.