public static Class elementType(Class clazz, int dim) {
        checkArrayType(clazz);

        if (dim < 0) {
            throw new IllegalArgumentException("The target dimension should not be less than zero: " + dim);
        }

        while (clazz.isArray() && dimension(clazz) > dim) {
            clazz = clazz.getComponentType();
        }

        return clazz;
    }
public static Class elementType ( Class clazz , int dim ) { checkArrayType ( clazz ) ; if ( dim < 0 ) { throw new IllegalArgumentException ( "The target dimension should not be less than zero: " + dim ) ; } while ( clazz . isArray ( ) && dimension ( clazz ) > dim ) { clazz = clazz . getComponentType ( ) ; } return clazz ; }
Get the type of array elements by the dimension

@param clazz the type of array
@param dim the target dimension
@return the result array