for (int i=0; i<bitmap.length; i++) { for (int j=0; j<bitmap[i].length; j++) { if (bitmap[i][j] == 0) { Array[i][j] = "."; } else { Array[i][j] = "0";} System.out.print(Array[i][j] +" ");
Hiya,
I need to get this to align correctly, however, although it displays, it displays as only one long line, whereas bitmap is:
int[][] bitmap = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0}, {0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, {0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
Adding "\n" puts them all on new lines. It is very important it breaks after 20 ".". .This is my first time working with 2d arrays. Thanks.