ArrayUtils { public static Integer[] toIntegerArray(final int[] array) { final Integer[] integerArray = new Integer[array == null ? 0 : array.length]; if (array != null) { for (int index = 0; index < array.length; index++) { integerArray[index] = array[index]; } } return integerArray; }  static T getElementAtIndex(T[] array, int index, T defaultValue); static T getFirst(final T... array); static String toString(final Object... array); static String toString(final String... array); static Object[] insert(Object[] originalArray, int pos, Object element); static Object[] remove(Object[] originalArray, int pos); static String objectRefString(Object obj); static void objectRefString(Object obj, StringBuilder sb); static String objectString(Object obj); static void objectString(Object obj, StringBuilder sb); static String objectStringNonRecursive(@Unretained Object obj); static boolean areByteArrayArrayEquals(byte[][] v1, byte[][] v2); static void objectStringNonRecursive(@Unretained Object obj, StringBuilder sb); static boolean objectEquals(Object o1, Object o2); static Integer[] toIntegerArray(final int[] array); static Byte[][] toByteArray(final byte[][] array); static byte[][] toBytes(final Byte[][] byteArray); static List<T> asList(T... array);  }
@Test public void toIntegerArray_returnsOrderedArray() { int[] sequence = new int[] {0, 1, 2, 4, 8}; assertThat(toIntegerArray(sequence)).isNotNull().hasSize(sequence.length).containsExactly(0, 1, 2, 4, 8); }
@Test public void toIntegerArray_empty_returnsEmptyArray() { assertThat(toIntegerArray(new int[] {})).isNotNull().hasSize(0); }
@Test public void toIntegerArray_null_returnsEmptyArray() { assertThat(toIntegerArray(null)).isNotNull().hasSize(0); }