I need help to complete the removal of the row with max element. I managed to read the user's input to set up the matrix dimension, filled the matrix with random numbers and search for the maximum element. However, I can't delete the row with the max element.
public class Main {
static int MAX = 0;
public static void main(String[] args) {
System.out.println("My name");
System.out.print("Enter N: ");
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
Integer matrix[][] = new Integer[N][N];
Initialization(matrix);
Search(matrix);
}
static void Initialization(Integer[][] matrix) {
Random r = new Random();
System.out.println("Matrix before processing");
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix.length; j++) {
matrix[i][j] = r.nextInt(100);
System.out.print(matrix[i][j] + "\t");
}
System.out.print("\n");
}
}
static void Search(Integer matrix[][]) {
int max = 0;
for(int i = 0; i < matrix.length; i++) {
for(int j = 0; j < matrix.length; j++) {
if (matrix[i][j] > max) {
max = matrix[i][j];
}
}
}
MAX = max;
System.out.println("Max element in matrix: " + max);
}
}