'How to check character of ith row in 2D array?

public static boolean won() {
    for(int i = 0; i < board.length; i++){
        for(int j = 0; j < board[i].length; j++){
            char column1 = board[i][0];
            char column2 = board[i][1];
            char column3 = board[i][2];
            char row1 = board[0][j];
            char row2 = board[1][j];
            char row3 = board[2][j];
            char diag1 = board[i][0];
            char diag2 = board[i][0];
            boolean[] winConditions; 
            winConditions[6] = {column1, column2, column3, row1, row2, row3};
            
            if(winCondition == player){
                System.out.println(player + " has won!");
            }
        }
    }
    return false; // TODO: replace with your own return statement.
}

I know this code is a mess and incorrect. Here 'board' is a 2d array that prints out the game for TicTacToe. I cannot change the class parameter.

I am trying to go create an array of character whose elemtents come from the 2d array - 'board'. I want to go through all over them and if one of the element in array is true, with all entries being 'player' (= 'X'/ = 'O') then this class will determine the winner.

I am trying to make an array 'winningConditons', from this, how would I make it go through all over the elements (that are my winning conditions) and check if any one is true?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source