I need help.

Let's say I have 4x4 matrix like this one:

Attachment 1841

I need to code a function unique(int[][] square) that -- inspects every value in square checking that each one is a unique integer in the range describes above. This does not require four nested loops...

For a square to be unique...it has to

- have each box with a different #, cannot repeat numbers.

- make sure that every number from 1-16 is in the box.

If the two above are true, then return true...

Does anyone know what I would be able to do.. I tried doing something like this:

Any ideas? The above code does not work.Code:`public static boolean unique(int[][]square) {`

int[] array=new int[2*(square.length)];

int count=1;

for(int r=0; r<square.length;r++)

{

for(int c=0; c<square[r].length; c++)

{

if(square[r][c]==count)

{

count++;

array[count]=count;

}

}

}

}