,
Object[] oa = new Object[] {1, new Object[] {"a", new int[] {5, 6, 7}, "c"}, 3};
getComponentType . ,
static int maxDim(Object[] oa) {
int maxDim = 0;
for(Object o: oa) {
if(o instanceof int[] || o instanceof long[] || o instanceof short[] ||
o instanceof byte[] || o instanceof float[] ||
o instanceof double[] || o instanceof boolean[]) {
maxDim = Math.max(maxDim, 1);
} else if(o instanceof Object[]) {
maxDim = Math.max(maxDim, maxDim((Object[])o));
}
}
return maxDim + 1;
}