i tried using this where ros and cols is an integer which is equals to 8
if (i == ros || j == cols) {
if (i == ros && j > cols) {
cols++;
} else if (i == ros && j < cols) {
cols--;
} else if (j == cols && i > ros) {
ros++;
} else if (j == cols && i < ros) {
ros--;
}
int k = secret.nextInt();
Tile boardtile = playersarray[currentPlayer].gettile(k);
b.add(i, j, boardtile);
System.out.println("");
b.Print_Board();
System.out.println("");
playersarray[currentPlayer].add_Tile(boardtile);
playersarray[currentPlayer].gettiles().remove(k);