I found this topic on a similar Stack Overflow thread.
In c++, when you make an array int[i][j] you get row major order, so iterating by row will give you caches which contain more useful data.
In java, there is no 2d array, but it still creates something similar enough in terms of caches. My question is, does it create the arrays of actual data in the size of row, or does it create the array of pointers in size of row?
Or, as the top answer on the similar Stack Over thread said, does it do something entirely different where int[5][8] would be an array of 5 pointers to arrays of any size that all add up to (5*8)?
It said java makes jagged arrays, and I can't think of any good reason for this to be true.