1. Using One-Dimensional Array

    • e.g. String - Array of characters

  2. Using Two-Dimensional Array

    • e.g. Picture (ADT) - 2D array of colors (Color is set of three 8-bit integers)‚Äč
    • Reverse Image Code

Picture source = new Picture(args[0]);

int width = source.width();

int height = source.height();

Picture target = new Picture(width, height);

for (int i = 0; i < width; i++)

for (int j = 0; j < height; j++)

target.set(i, height-j-1, source.get(i, j));

target.show();