@Test public void testReverseCopy(){ long[] inputArray1 = { 2, 2, 4, 6, 8, 15 }; long[] result = ArrayUtil.reverseCopy(inputArray1, inputArray1.length); Assert.assertArrayEquals(new long[] { 15, 8, 6, 4, 2, 2 }, result); }
public static long[] reverseCopy(long[] original, int newLength) { long[] result = new long[newLength]; int originalLimit = original.length - newLength; for (int i = original.length - 1, resultIdx = 0; i >= originalLimit; i--) { result[resultIdx++] = original[i]; } return result; }
ArrayUtil { public static long[] reverseCopy(long[] original, int newLength) { long[] result = new long[newLength]; int originalLimit = original.length - newLength; for (int i = original.length - 1, resultIdx = 0; i >= originalLimit; i--) { result[resultIdx++] = original[i]; } return result; } }
ArrayUtil { public static long[] reverseCopy(long[] original, int newLength) { long[] result = new long[newLength]; int originalLimit = original.length - newLength; for (int i = original.length - 1, resultIdx = 0; i >= originalLimit; i--) { result[resultIdx++] = original[i]; } return result; } private  ArrayUtil(); }
ArrayUtil { public static long[] reverseCopy(long[] original, int newLength) { long[] result = new long[newLength]; int originalLimit = original.length - newLength; for (int i = original.length - 1, resultIdx = 0; i >= originalLimit; i--) { result[resultIdx++] = original[i]; } return result; } private  ArrayUtil(); static Long[] toLongArr(String[] strArr); static Long[] toLongArr(long[] longArr); static long[] toRawLongArr(String[] strArr); static int[] toRawIntArr(String strArr[]); static long[] toLongArr(Collection<Long> ids); static int[] toIntArr(Collection<Integer> ids); static String[] splitSimpleString(String str); static String toSimpleString(long a[]); static void reverse(long[] b); static void reverse(long[][] b); static long[] reverseCopy(long[] original, int newLength); static long[] reverseCopyRange(long[] original, int from, int to); static long[] removeAll(long[] sourceArray, long[] removeArray); static long[] removeAll(long[] sourceArray, Set<Long> removeSet); static long[] sort(long left[], long right[]); static void sortDesc(long[] a); static long[] intersectionOrder(long[] arr1, long[] arr2); static long[] addTo(long[] left, long[] right); static long[] addTo(long[] arr, long id); static long[] addTo(long[] arr, long id, int limit); static long[] getLimited(long[] arr, int limit); }
ArrayUtil { public static long[] reverseCopy(long[] original, int newLength) { long[] result = new long[newLength]; int originalLimit = original.length - newLength; for (int i = original.length - 1, resultIdx = 0; i >= originalLimit; i--) { result[resultIdx++] = original[i]; } return result; } private  ArrayUtil(); static Long[] toLongArr(String[] strArr); static Long[] toLongArr(long[] longArr); static long[] toRawLongArr(String[] strArr); static int[] toRawIntArr(String strArr[]); static long[] toLongArr(Collection<Long> ids); static int[] toIntArr(Collection<Integer> ids); static String[] splitSimpleString(String str); static String toSimpleString(long a[]); static void reverse(long[] b); static void reverse(long[][] b); static long[] reverseCopy(long[] original, int newLength); static long[] reverseCopyRange(long[] original, int from, int to); static long[] removeAll(long[] sourceArray, long[] removeArray); static long[] removeAll(long[] sourceArray, Set<Long> removeSet); static long[] sort(long left[], long right[]); static void sortDesc(long[] a); static long[] intersectionOrder(long[] arr1, long[] arr2); static long[] addTo(long[] left, long[] right); static long[] addTo(long[] arr, long id); static long[] addTo(long[] arr, long id, int limit); static long[] getLimited(long[] arr, int limit);  }