Java Utililty Methods Array Dimension Get

List of utility methods to do Array Dimension Get

Description

The list of methods to do Array Dimension Get are organized into topic(s).

Method

intarrayDim(Class c)
array Dim
if (c.isArray() && !c.getComponentType().isArray())
    return 1;
else
    return 1 + arrayDim(c.getComponentType());
intarrayDimension(String clsName)
Computes the dimension of the array class specified by name.
int arrayDim = 0;
if (clsName.startsWith("[")) {
    for (int i = 0; i < clsName.length(); i++) {
        if (clsName.charAt(i) != '[') {
            break;
        arrayDim = i + 1;
return arrayDim;
intarrayDimensions(Class arrayClass)
Get the dimension of an array
verifyIsArray(arrayClass); 
return arrayClass.getName().lastIndexOf("[") + 1;
intarrayDimensions(Class c)
Return the number of array dimensions represented by the given class.
Class<?> rest = c;
int result = 0;
while (rest.isArray()) {
    rest = rest.getComponentType();
    result++;
return result;
int[]arraysDims(String[] arr)
arrays Dims
if (arr.length > 1) {
    int[] idx = new int[arr.length - 1];
    for (int i = 1; i < arr.length; i++) {
        idx[i - 1] = Integer.parseInt(arr[i]);
    return idx;
return null;
...