Java - 2D array checking diagonal number board
Currently I'm working on a program that generates random 0's and 1's in a 8x8 2D array board. What I have to do is check whether or not if all the numbers on the diagonal are the same (starting from the corners, not just any diagonals) example: int[][] array = { {0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 1, 0, 1, 0, 1, 0}, {0, 0, 0, 0, 1, 1, 1, 0}, {0, 0, 0, 0, 1, 1, 1, 0}, {0, 0, 1, 1, 0, 1, 1, 0}, {0, 0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 1, 1, 1, 1, 0} }; So if by chance all the numbers starting from the top left corner (0,0),(1,1)...(7,7) are all either 0's or 1's then I have to