Java Array Dimension Get arrayDim(Class c)

Here you can find the source of arrayDim(Class c)

Description

array Dim

License

Open Source License

Declaration

public static int arrayDim(Class<?> c) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Andre L. Santos.//from   w  w  w  .  ja va 2 s . c om
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Andre L Santos - developer
 ******************************************************************************/

public class Main {
    public static int arrayDim(Class<?> c) {
        if (c.isArray() && !c.getComponentType().isArray())
            return 1;
        else
            return 1 + arrayDim(c.getComponentType());
    }
}

Related

  1. arrayDimension(String clsName)
  2. arrayDimensions(Class arrayClass)
  3. arrayDimensions(Class c)
  4. arraysDims(String[] arr)