To manipulate a 2D array, you almost always use . The outer loop typically traverses the rows. The inner loop traverses the columns within each row.

Swap elements within a row (e.g., element at c swaps with width - 1 - c ).

Manipulation goes beyond just printing values. It involves changing the data, searching for patterns, or aggregating values. Here are the three most common manipulation tasks.

When manipulating arrays—especially in pathfinding or neighbor-checking algorithms—the most common error is the ArrayIndexOutOfBoundsException .

Assign grid[r][c] = value; inside your nested loops. B. Row-Major vs. Column-Major Processing