True noob question here. Need to check two arrays are equal (in contained values), after failing googled and got Arrays.equals(a,b,)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public void checkColours(int[][] p) { if(!Arrays.equals(colourOffset, p)) { System.out.println("\nArrays not equal"); System.out.println("Recieved array: "); for(int i = 0; i < 7; i++) { for(int n = 0; n < 3; n++) { System.out.print(p[i][n]); } } System.out.println("\nStored array: "); for(int i = 0; i < 7; i++) { for(int n = 0; n < 3; n++) { System.out.print(colourOffset[i][n]); } } |
Output:
Arrays not equal
Recieved array:
000000000000000000000
Stored array:
000000000000000000000
Arrays are both created: colourOffset = new int[7][3]; int col[][] = new int[7][3]; (that one is sent as p)
What am I doing wrong?