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