ArrayUtil { public static Class<?> getType(Object array) { Class<?> type = array.getClass(); while (type.isArray()) { type = type.getComponentType(); } return type; }  static Object flatten(Object array); static Object unflatten(Object array, int[] dimensions); static int[] getDimensions(Object array); static Class<?> getType(Object array); static Object transformArray(Object array, Function<F, T> transform, Class<T> toType);  }
@Test(dataProvider = "typedArrays") public void testGetType(Object array, Class<?> type) throws Exception { assertEquals(ArrayUtil.getType(array), type); }