/*------------------------------------------------------------------------ // Creating a random 2D filled matrix int matrix[][] = new int[10][10]; for (int row = 0; row < matrix.length; row++) { for (int column = 0; column < matrix[row].length; column++){ matrix[row][column] = (int)(Math.random() * 100); } } /*------------------------------------------------------------------------ // Displaying the filled 2D matrix for (int row = 0; row < matrix.length; row++) { for (int column = 0; column < matrix[row].length; column++){ System.out.print(matrix[row][column] + " "); } System.out.println(); } /*------------------------------------------------------------------------ // Displaying the data of each column in the above random filled array int[] a = new int[10]; for (int column = 0; column < matrix[0].length; column++) { for (int row = 0; row < matrix.length; row++) a[row]= matrix[row][column]; System.out.println("Column " + column + " is "+ Arrays.toString(a)); } /*------------------------------------------------------------------------*/