### Question:
ReflectionUtil { public static <T> T[] toArray(Collection<T> c, T[] a) { return c.size() > a.length ? c.toArray((T[]) Array.newInstance(a.getClass().getComponentType(), c.size())) : c.toArray(a); } private  ReflectionUtil(); static T convertValueMapValue(ValueMap valueMap, String name, Type declaredType); static T convertValueMapValue(InheritanceValueMap valueMap, String name, Type declaredType); static T[] toArray(Collection<T> c, T[] a); static T[] toArray(Collection<T> c, Class klass); static T[] toArray(Collection<T> c); static boolean isArray(Type declaredType); static boolean isArray(Class<?> clazz); static boolean isCollectionType(Type declaredType); static boolean isCollectionType(Class<?> collectionType); static boolean isSetType(Type declaredType); static boolean isSetType(Class<?> collectionType); static boolean isListType(Type declaredType); static boolean isListType(Class<?> collectionType); static Class<?> getClassOrGenericParam(Type type); static boolean isAssignableFrom(Type assignableFromType, Class<?> clazz); static boolean hasGenericParameter(Type type); static Class<?> getGenericParameter(Type type); static Class<?> getGenericParameter(Type type, int index); static Object castStringValue(String allowedValue);  }### Answer:
@Test public void toArray() { List<Integer> integerList = Arrays.asList(1, 2); Integer[] integers = ReflectionUtil.toArray(integerList); assertEquals(2, integers.length); assertEquals(2, integers[1].intValue()); }