This question makes assumptions which are not valid. It assumes that the way you 'imagine' the 2D array is based on whether you consider the first dimension to be a row, or a column. The truth is that it does not matter, and your 'imaginings' are irrelevant. In either of your imagined situations, it very much depends on whether the first dimension is larger than the second. Any performance differences would be dependent on the compiler/JVM used, and the actual memory layout in the system, which is unspecified. Ultimately, this question is unclear. —
rolfl ♦ 1 min ago