I have found answers to this question in c# but not in java. I want to make my own class to work with vectors and matrices, and perform various operations such as the dot product. Since an array will be passed on to the class, without knowing its dimensions beforehand, it would be important to know it. I was wondering if there is any function to get it. Thanks in advance. Here is an example:
int[] array = new int[10]; //this would be a 1D array of length 10
int[][][] array2 = new int[5][10][2]; //This one is 3D of length 100
What I want is "the number of square brackets" there are, which state the dimension of the array.