>>1
how do i tell which [] has the rows and which has the columns?
In a real language:
1) Clear the array if necessary
2) Poke [0][1] of the array with a value
3) Look at the address of [0][0] +1 (or plus however many bytes wide a single element is)
4) Is it still clear or is it the value you put in [0][1] ???
Your language may not even allow you to do something like this but I know it would work in say, C, or most any language that lets you use pointers in any way.
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int main()
{
uint8_t myArray[2][2];
memset(myArray, 0, 2*2); /* set all elements to 0 */
*(&myArray[0][0] +1) = 1;
if (myArray[0][1])
printf("Row-major order");
else
printf("Column-major order");
}
The result in C is that the second dimension is that [0][1] = 1, indicating that you begin counting with the second dimension.
I have no idea if you can do anything like this in Java. As far as I know, pointers are forbidden or something like that.