[java] Algorithm for Determining Tic Tac Toe Game Over