1for (int row = 0; row < arr.length; row++)//Cycles through rows
2{
3 for (int col = 0; col < arr[row].length; col++)//Cycles through columns
4 {
5 System.out.printf("%5d", arr[row][col]); //change the %5d to however much space you want
6 }
7 System.out.println(); //Makes a new row
8}
9//This allows you to print the array as matrix
1public static void printMatrix(Object[][] matrix){
2 for (int i = 0; i < 3; i++) {
3 for (int j = 0; j < 3; j++) {
4 System.out.print(matrix[i][j] + " ");
5 }
6 System.out.println();
7 }
8 }