### Question:
ArrayUtil { public static long[] addTo(long[] left, long[] right){ if (left == null) { return ArrayUtils.clone(right); } else if (right == null) { return ArrayUtils.clone(left); } long[] result = new long[left.length + right.length]; int pos = 0; System.arraycopy(left, 0, result, pos, left.length); pos += left.length; System.arraycopy(right, 0, result, pos, right.length); 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);  }### Answer:
@Test public void testAddToArrays(){ long[] array1 = { 2, 2, 4, 6, 8, 15 }; long id = 345; long[] result = ArrayUtil.addTo(array1, id); Assert.assertArrayEquals(new long[] { 2, 2, 4, 6, 8, 15, 345 }, result); }
@Test public void testAddToLimit() { long[] array1 = { 2, 2, 4, 6, 8, 15, 17 }; long id = 345; int limit = 10; long[] result = ArrayUtil.addTo(array1, id, limit); Assert.assertArrayEquals(new long[] { 2, 2, 4, 6, 8, 15, 17, 345 }, result); result = ArrayUtil.addTo(result, 4, limit); Assert.assertArrayEquals(new long[] { 2, 2, 4, 6, 8, 15, 17, 345}, result); result = ArrayUtil.addTo(result, 124, limit); result = ArrayUtil.addTo(result, 125, limit); Assert.assertArrayEquals(new long[] { 2, 2, 4, 6, 8, 15, 17, 345, 124, 125}, result); result = ArrayUtil.addTo(result, 126, limit); Assert.assertArrayEquals(new long[] { 2, 4, 6, 8, 15, 17, 345, 124, 125, 126}, result); result = ArrayUtil.addTo(result, 127, limit); Assert.assertArrayEquals(new long[] { 4, 6, 8, 15, 17, 345, 124, 125, 126, 127}, result); }