Checking arrays equal

True noob question here. Need to check two arrays are equal (in contained values), after failing googled and got Arrays.equals(a,b,)

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?

Probably because its a multidimensional array and Arrays.equals is therefore comparing int[] array references. You could for loop through first dimension and use Arrays.equals on each second dimension array.

ah of course you’re right thanks

Edit: Arrays.deepEquals(a,b) solves the problem