Determining the Dimensions of an Array public static int getDim(Object array) { int dim = 0; Class cls = array.getClass(); while (cls.isArray()) { dim++; cls = cls.getComponentType(); } return dim; }