What are the advantages of representing multidimensional arrays with pointers to arrays instead of a "flat" version where everything is stored contiguously and access is simply pointer arithmetic? EDIT: For the JVM, not manually. I'm asking about the internal representation, not a manual flattening by the user.
long[][] foo = new long[2][];
foo[0] = new long[5];
foo[1] = new long[3];
// ...
foo[0] = new long[7];
Although I think as a developer you probably almost always want to index a single flat flat array if the dimensions are fixed. This is much faster.