public class MyClass {
public static void main(String args[]) {
int matrix[][] = {
{1, 2, 3, 5},
{4, 5, 6, 1},
{7, 8, 9, 0}
};
int rows = matrix.length;
int cols = matrix[0].length;
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
System.out.print(matrix[j][i] + " ");
}
System.out.println();
}
}
}
/*
run:
1 4 7
2 5 8
3 6 9
5 1 0
*/