Is it possible in Java to find the number of dimensions of an array with an \'a priori\' unknown number of dimensions? That is, if one doesn\'t know the number of dimensions
Assuming your matrix is called m:
You can get the number of columns by running
m.length;
With Java, multidimensional arrays are actually arrays of arrays. The number of rows is variable. Assuming i is an integer between 0 and m.length-1 you can do:
m[i].length;
To get the number of elements in the row.