Since I don't like relying on tabs, I'd like to mention some approaches that don't rely on them.
If you know that all of the numbers in the table are nonnegative numbers of, say, 4 digits or less, you can use String.format in a manner similar to Nitin's answer:
for (int i = 0; i < TotRow; i++) {
for (int j = 0; j < TotCol; j++) {
System.out.print(String.format("%4d ", board[i][j]));
}
System.out.println();
}
The %4d means to format the number using a width of 4 characters, and pad with blanks on the left if the number takes fewer than 4 characters to print. Thus, if there aren't any 5-digit or longer numbers, each print will print exactly 5 characters--a 4-character field for the number, and a space after the number. This will make everything line up, as long as none of the numbers is too large. If you do get a number that takes more than 4 characters, the formatting will get messed up.
Here's a way to adjust the column width so that it's just large enough to hold all the values in the table, and works fine if there are negative numbers:
int maxWidth = 0;
for (int i = 0; i < TotRow; i++) {
for (int j = 0; j < TotCol; j++) {
maxWidth = Math.max(maxWidth, Integer.toString(board[i][j]).length());
}
}
String format = "%" + maxWidth + "d ";
for (int i = 0; i < TotRow; i++) {
for (int j = 0; j < TotCol; j++) {
System.out.print(String.format(format, board[i][j]));
}
System.out.println();
}
Note: not tested