public boolean isPlayerWon(int player) {
        int total = 0;
        int checkTot;

        if (player == 1) {
            checkTot = 3;
        } else if (player == 2) {
            checkTot = -3;
        } else {
            return false;
        }


        for (int i = 0; i < 3; i++) {
            total = 0;
            for (int j = 0; j < 3; j++) {
                System.out.println(ar[i][j]);
                total += ar[i][j];
            }
            if (total == checkTot) {
                for (int j = 0; j < 9; j++) {
                    clicked[j] = 1;
                }
                return true;
            }
        }

        for (int k = 0; k < 3; k++) {
            total = 0;
            for (int l = 0; l < 3; l++) {
                total += ar[l][k];
            }
            if (total == checkTot) {
                for (int j = 0; j < 9; j++) {
                    clicked[j] = 1;
                }
                return true;
            }
        }

        total = 0;
        for (int m = 0; m < 3; m++) {
            total += ar[m][m];
        }
        if (total == checkTot) {
            for (int j = 0; j < 9; j++) {
                clicked[j] = 1;
            }
            return true;
        }

        total = 0;
        int p = 2;
        for (int n = 0; n < 3; n++) {
            total += ar[n][p];
            p--;
        }
        if (total == checkTot) {
            for (int j = 0; j < 9; j++) {
                clicked[j] = 1;
            }
            return true;
        }
        return false;
    }