(int mat[][])
| 46 | |
| 47 | // to print out the matrix |
| 48 | public static void print2D(int mat[][]) { |
| 49 | // Loop through all rows |
| 50 | for (int i = 0; i < mat.length; i++){ |
| 51 | // Loop through all elements of current row |
| 52 | for (int j = 0; j < mat[i].length; j++){ |
| 53 | System.out.print(mat[i][j] + " "); |
| 54 | } |
| 55 | System.out.println(); |
| 56 | } |
| 57 | |
| 58 | } |
| 59 | } |