This method of the SafeArray Class obtains the number of SafeArray dimensions.
public int getNumDim();
Returns the number of dimensions in the SafeArray (2 for two-dimensional SafeArrays, for example).