Here you can find the source of arrayLength(Object o)
public static int arrayLength(Object o)
//package com.java2s; //License from project: Apache License public class Main { public static int arrayLength(Object o) { if (o instanceof Object[]) return ((Object[]) o).length; else if (o instanceof boolean[]) return ((boolean[]) o).length; else if (o instanceof float[]) return ((float[]) o).length; else if (o instanceof double[]) return ((double[]) o).length; else if (o instanceof char[]) return ((char[]) o).length; else if (o instanceof byte[]) return ((byte[]) o).length; else if (o instanceof short[]) return ((short[]) o).length; else if (o instanceof int[]) return ((int[]) o).length; else if (o instanceof long[]) return ((long[]) o).length; throw new ClassCastException(notArrayType(o)); }/*from www . j av a2s .c om*/ private static String notArrayType(Object o) { return (o == null ? "null" : o.getClass().getName()) + " is not an array type"; } }