2d Array Store Values As Matrix Format Java
i have this array here that cfreates a 7x7 matrix using random strings when i try to get the value of the array the values print in a line format when i use pritnln the matrix is c
Solution 1:
Remove ++column;
in below code, since you have already incremented column
in the for
statement:
for (int row = 0; row < WIDTH_EASY; ++row) {
for (int column = 0; column < WIDTH_EASY; ++column) {
getCurrentState().board_elements[row][column] = new BoardElement();
getCurrentState().board_elements[row][column].max_connecting_bridges = Integer.parseInt(debug_board_state[row][column]);
getCurrentState().board_elements[row][column].row = row;
getCurrentState().board_elements[row][column].col = column;
if (getCurrentState().board_elements[row][column].max_connecting_bridges > 0) {
getCurrentState().board_elements[row][column].is_island = true;
}
++column; // remove this line
}
}
Post a Comment for "2d Array Store Values As Matrix Format Java"