I have a quick question that I'm hoping someone can help me with on here. I have 2 2d int arrays that I create for a board state and a solution that look something like this:

int[][] P1 = new int[][]{{0,2,0,0,0,0},{0,0,3,0,0,0},{5,0,0,0,0,0} etc. ect.

They're 6x6 arrays and I need a way to compare the two arrays to see if they're exactly equal, I can only compare memory references. I've researched this a bit and can't find a solution. I would like help quickly if possible. Thanks!

Recommended Answers

All 2 Replies

check out the deepEquals method of the Arrays class.

check out the deepEquals method of the Arrays class.

Wow thanks a lot, can't believe I never saw that mentioned.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.