ReflectionUtil { public static Object arrayClone(Object array) { Class<?> clazz = array.getClass(); if (!clazz.isArray()) { throw new IllegalArgumentException( "Input object is not an array: " + array); } try { return _cloneMethod.invoke(array); } catch (Exception exception) { return throwException(exception); } }  static Object arrayClone(Object array); static Field getDeclaredField(Class<?> clazz, String name); static Field[] getDeclaredFields(Class<?> clazz); static Method getDeclaredMethod(
			Class<?> clazz, String name, Class<?>... parameterTypes); static Class<?>[] getInterfaces(Object object); static Class<?>[] getInterfaces(
		Object object, ClassLoader classLoader); static Class<?>[] getInterfaces(
		Object object, ClassLoader classLoader,
		Consumer<ClassNotFoundException> classNotFoundHandler); static T throwException(Throwable throwable); static Field unfinalField(Field field);  }
@Test public void testArrayClone() throws Exception { Object object = new Object(); try { ReflectionUtil.arrayClone(object); Assert.fail(); } catch (IllegalArgumentException illegalArgumentException) { Assert.assertEquals( "Input object is not an array: " + object, illegalArgumentException.getMessage()); } object = new long[] {1, 2, 3}; Object clone = ReflectionUtil.arrayClone(object); Assert.assertNotSame(object, clone); Assert.assertArrayEquals((long[])object, (long[])clone); Field field = ReflectionUtil.getDeclaredField( ReflectionUtil.class, "_cloneMethod"); field.set(null, null); try { ReflectionUtil.arrayClone(object); Assert.fail(); } catch (NullPointerException nullPointerException) { Assert.assertNull(nullPointerException.getCause()); } }