code: public int getDimensions(Object array) {
          if (!isArray(array)) { return 0; }
  
          int dimensions = 0;
          Class<?> type = array.getClass();
          while (type.isArray()) {
              dimensions++;
              type = type.getComponentType();
          }
  
          return dimensions;
      }
docs: Get the number of dimensions of the given array. If the array is not
  actually an array, then <code>0</code> is returned. Otherwise, if the
  array is single-dimension, then <code>1</code> is returned. If the array
  is multi-dimensional, the total number of dimensions is returned. For
  example, <code>Type[][][]</code> would return <code>3</code>.
  
  @param array The array to get the number of dimensions from
  
  @return The number of dimensions in the given array