Advertisement
marcopolo1613

Untitled

Jun 23rd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. for(int y = 0; y <= height; y++) // an iteration of this loop will move you down one row
  2. {
  3.      for(int x = 0; x <= width; x++)
  4.      {
  5.      // an iteration of this loop will move you to the right one column.
  6.      // This will go through an entire row before exiting the loop and giving y a chance to move down.
  7.  
  8.      newArray[x][y] = oldArray[x][y]; // takes the current xy-position in your 2D array and saves it to the new array
  9.      // x increases by one
  10.      }
  11. // y increases by one
  12. }
  13.  
  14. /*
  15. your multi-dimensional array is like a coordinate system, and each point in the system holds data. like a color for a pixel at (x,y).
  16. x -->
  17. [][][][][][]  y
  18. [][][][][][]  |
  19. [][][][][][]  |
  20.               V
  21.  
  22. If you save each item from a row into a new array, then move down and save each item in the row into the new array, and continue until you hit the bottom, then you will have moved through every element in the array.
  23. (0,0)(1,0)(2,0)(3,0)(4,0)(5,0)
  24. (0,1)(1,1)(2,1)(3,1)(4,1)(5,1)
  25. (0,2)(1,2)(2,2)(3,2)(4,2)(5,2)
  26. etc.
  27. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement