public static Object convertArrayElements(Class<?> arrayType, Object array) { Class<?> src = array.getClass().getComponentType(); Class<?> dst = arrayType.getComponentType(); if (src == null || dst == null) throw new IllegalArgumentException("not array type"); Wrapper sw = (src.isPrimitive() ? Wrapper.forPrimitiveType(src) : null); Wrapper dw = (dst.isPrimitive() ? Wrapper.forPrimitiveType(dst) : null); int length; if (sw == null) { Object[] a = (Object[]) array; length = a.length; if (dw == null) return Arrays.copyOf(a, length, arrayType.asSubclass(Object[].class)); Object res = dw.makeArray(length); dw.copyArrayUnboxing(a, 0, res, 0, length); return res; } length = j86.java.lang.reflect.Array.getLength(array); Object[] res; if (dw == null) { res = Arrays.copyOf(NO_ARGS_ARRAY, length, arrayType.asSubclass(Object[].class)); } else { res = new Object[length]; } sw.copyArrayBoxing(array, 0, res, 0, length); if (dw == null) return res; Object a = dw.makeArray(length); dw.copyArrayUnboxing(res, 0, a, 0, length); return a; }