### Question:
ArrayShort extends Array<Short> { @Override void arraycopy(int srcPos, Object dest, int destPos, long length) { if (indexFn.isCanonicalOrder()) { storage.arraycopy(srcPos, dest, destPos, length); } else { short[] ddest = (short[]) dest; int destIndex = destPos; Iterator<Integer> iter = indexFn.iterator(srcPos, length); while (iter.hasNext()) { ddest[destIndex++] = storage.get(iter.next()); } } } ArrayShort(DataType dtype, int[] shape);  ArrayShort(DataType dtype, int[] shape, Storage<Short> storage); private  ArrayShort(DataType dtype, IndexFn indexFn, Storage<Short> storageD); @Override Iterator<Short> fastIterator(); @Override Iterator<Short> iterator(); @Override Short get(int... index); @Override Short get(Index index);  }### Answer:
@Test public void testNonCanonicalOrder() { int[] shape = new int[] {1, 2, 3}; Storage<Short> store = new ArrayShort.StorageS(new short[] {1, 2, 3, 4, 5, 6}); Array<Short> array = new ArrayShort(DataType.SHORT, shape, store); array = Arrays.flip(array, 1); short[] expected = new short[] {4, 5, 6, 1, 2, 3}; int count = 0; for (short val : array) { assertThat(val).isEqualTo(expected[count]); count++; } short[] result = new short[3]; array.arraycopy(1, result, 0, 3); assertThat(result).isEqualTo(new short[] {5, 6, 1}); }