user5762337
user5762337

Reputation:

2 [][] int Arrays have the exact same values, in the exact same position...How to check that efficiently?

I need help with my Multidimensional int [][] in Java. The first one is:

int [][] startArr = {{0,1,2},{3,4,5},{6,7,8}};

The second is:

int [][] testArr = {{0,1,2},{3,4,5},{6,7,8}};

Arrays.deepEquals(startArr, testArr)

returns false...But why? If I have such a situation, I want to quit the program. At the moment I am inside of an infinite loop because this check doesn't work properly. If one value inside testArr has an other position (then there are two values in different positions of course) than in startArr, it should return false.

Upvotes: 2

Views: 41

Answers (0)

Related Questions