### Question:
Arrays { public static <T> Array<T> flip(Array<T> org, int dim) { return org.createView(org.indexFn().flip(dim)); }  static Array<T> factory(DataType dataType, int[] shape, Storage<T> storage); static Array<T> factory(DataType dataType, int[] shape, Object dataArray); static Array<T> factory(DataType dataType, int[] shape); static Array<T> factoryCopy(DataType dataType, int[] shape, List<Array<T>> dataArrays); static Array<T> factoryArrays(DataType dataType, int[] shape, List<Array<?>> dataArrays); static Array<T> flip(Array<T> org, int dim); static Array<T> permute(Array<T> org, int[] dims); static Array<T> reshape(Array<T> org, int[] shape); static Array<T> reduce(Array<T> org); static Array<T> reduce(Array<T> org, int dim); static Array<T> section(Array<T> org, List<Range> ranges); static Array<T> slice(Array<T> org, int dim, int value); static Array<T> transpose(Array<T> org, int dim1, int dim2); static long computeSize(int[] shape); static boolean isVariableLength(int[] shape); static int[] removeVlen(int[] shape);  }### Answer:
@Test public void testFlip() { Array<Double> flip0 = Arrays.flip(array, 0); assertThat(flip0.get(0, 0, 0)).isEqualTo(1); assertThat(flip0.get(0, 0, 1)).isEqualTo(2); assertThat(flip0.get(0, 0, 2)).isEqualTo(3); assertThat(flip0.get(0, 1, 0)).isEqualTo(4); assertThat(flip0.get(0, 1, 1)).isEqualTo(5); assertThat(flip0.get(0, 1, 2)).isEqualTo(6); double[] expected = new double[] {1, 2, 3, 4, 5, 6}; int count = 0; for (double val : flip0) { assertThat(val).isEqualTo(expected[count]); count++; } Array<Double> flip1 = Arrays.flip(array, 1); assertThat(flip1.get(0, 1, 0)).isEqualTo(1); assertThat(flip1.get(0, 1, 1)).isEqualTo(2); assertThat(flip1.get(0, 1, 2)).isEqualTo(3); assertThat(flip1.get(0, 0, 0)).isEqualTo(4); assertThat(flip1.get(0, 0, 1)).isEqualTo(5); assertThat(flip1.get(0, 0, 2)).isEqualTo(6); expected = new double[] {4, 5, 6, 1, 2, 3}; count = 0; for (double val : flip1) { assertThat(val).isEqualTo(expected[count]); count++; } Array<Double> flip2 = Arrays.flip(array, 2); assertThat(flip2.get(0, 0, 2)).isEqualTo(1); assertThat(flip2.get(0, 0, 1)).isEqualTo(2); assertThat(flip2.get(0, 0, 0)).isEqualTo(3); assertThat(flip2.get(0, 1, 2)).isEqualTo(4); assertThat(flip2.get(0, 1, 1)).isEqualTo(5); assertThat(flip2.get(0, 1, 0)).isEqualTo(6); expected = new double[] {3, 2, 1, 6, 5, 4}; count = 0; for (double val : flip2) { assertThat(val).isEqualTo(expected[count]); count++; } }