I there, I am having problems formatting this 2d array. I was thinking about doing system.out.printf, but every time I do something like maybe %2f or something like that it doesn't work.
public static void main(String[] args) {
int t,i;
int[][] table = new int[5][6];
for (t = 0; t < 5; t++) {
for (i=0;i < 6; i++) {
table[t][i] = (t*6)+i+1;
System.out.print(table[t][i] + " ");
}
System.out.println();
}
}
}
This is the output:
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
The output should have the spaces perfectly aligned like this : http://prntscr.com/6kn2pq
\tif the numbers are not too big.