I also recommend that you use a 2 Dimensional array. It's essentially an array of arrays.
1 2
| int width = 10, height = 5; String[][] myArray = new String[width][height]; |
Then, when you want to retrieve a String, you can loop through it like...
1 2 3 4 5 6 7
| for(int x=0; x<width; x++) { for(int y=0; y<height; y++) { String element = myArray[x][y]; } } |
Oh, one last thing...
pixels[x+y] = blah blah blah... Is unsafe.
If x is 5 and y is 10, you get pixels[15] = blah blah blah.
If x is 10 and y is 5, you STILL get pixels[15] = blah blah blah.
It won't guarantee that you'll be writing to an empty slot in the array. 2D arrays are the best!