How can I print out a simple int [][] in the matrix box format like the format in which we handwrite matrices in. A simple run of loops doesn\'t apparently work. If it helps
int[][] matrix = { {1,2,3}, {4,5,6}, {7,8,9}, {10,11,12} }; printMatrix(matrix); public void printMatrix(int[][] m){ try{ int rows = m.length; int columns = m[0].length; String str = "|\t"; for(int i=0;i
Output:
| 1 2 3 | | 4 5 6 | | 7 8 9 | | 10 11 12 |