I have a big array of booleans and i need just to work with the true elements, and need theyer index.
for (int x = 0; x < cells.length; x++) {
for (int y = 0; y < cells[0].length; y++) {
if (cells[x][y]) {
g.fillRect(x * cellSize, y * cellSize, cellSize, cellSize);
}
}
}
so how can i do that without the two foor loops and save the time?