Skip to main content
2 of 4
added 58 characters in body
Alnitak
  • 441
  • 2
  • 7

Your setting of count = 0 should be immediately before the appropriate for loop, not after it, e.g:

private boolean rowCheck(){
    int sum = size * (size + 1) / 2;
    for (int i = 0; i <size; i++) {
        int count = 0;        // declaration moved, too
        for (int j = 0; j < size ; j++) {
            count += board[i][j];
        }
        if (count != sum) return false;
    }
    return true;
}

The point being that you should be setting the variable in advance of the loop, not resetting it afterwards (that being a pointless operation on the final iteration).

I would probably also move sum into a class member, calculated in the constructor.

Alnitak
  • 441
  • 2
  • 7