### Question:
TensorShape { public static int[] dimensionRange(int fromDimension, int toDimension) { if (fromDimension > toDimension) { throw new IllegalArgumentException("from dimension must be less than to dimension"); } int dimensionCount = toDimension - fromDimension; int[] dims = new int[dimensionCount]; for (int i = 0; i < dimensionCount; i++) { dims[i] = i + fromDimension; } return dims; } TensorShape(long[] shape); long[] getShape(); boolean isScalar(); boolean isLengthOne(); int getRank(); @Override boolean equals(Object o); @Override int hashCode(); static long getLength(long[] shape); static int getLengthAsInt(long[] shape); static long getLength(long[] shape, int... overDimensions); static long[] getRowFirstStride(long[] shape); static long getFlatIndex(long[] shape, long[] stride, long... index); static long[] getShapeIndices(long[] shape, long[] stride, long flatIndex); static boolean isScalar(long[] shape); static boolean isLengthOne(long[] shape); static long[] concat(long[] shape1, long[] shape2); static int[] dimensionRange(int fromDimension, int toDimension); static long[] selectDimensions(int from, int to, long[] shape); static int[] slideDimension(int from, int to, int rank); static long[] shapeDesiredToRankByAppendingOnes(long[] lowRankTensorShape, int desiredRank); static long[] shapeToDesiredRankByPrependingOnes(long[] lowRankTensorShape, int desiredRank); static long[] calculateShapeForLengthOneBroadcast(long[] shape1, long[] shape2); static long[] getBroadcastResultShape(long[] a, long[]... b); static long[] getBroadcastResultShape(long[] left, long[] right); static int[] getAbsoluteDimensions(int rank, int[] input); static long[] removeDimension(int dimension, long[] shape); static int getAbsoluteDimension(int dimension, int rank); static long[] getReductionResultShape(long[] inputShape, int[] reduceOverDimensions); static long[] getReductionResultShapeWithoutRankLoss(long[] shape, int[] reduceOverDimensions); static long[] getPermutedIndices(long[] indices, int... rearrange); static int[] invertedPermute(int[] rearrange); static long convertFromFlatIndexToPermutedFlatIndex(long fromFlatIndex,
                                                               long[] shape, long[] stride,
                                                               long[] permutedShape, long[] permutedStride,
                                                               int[] rearrange); static long[] getReshapeAllowingWildcard(long[] oldShape, long oldShapeLength, long[] newShape); static long[] getConcatResultShape(int dimension, Tensor... toConcat); static int[] getPermutationForDimensionToDimensionZero(int dimension, long[] shape); static long getBroadcastedFlatIndex(long fromFlatIndex, long[] fromStride, long[] toShape, long[] toStride); static boolean incrementIndexByShape(long[] shape, long[] index); static boolean incrementIndexByShape(long[] shape, long[] index, int[] dimensionOrder); static long[] getDiagResultShape(long[] shape); static long[] getDiagPartResultShape(long[] shape);  }### Answer:
@Test public void canGetDimensionRange() { int[] actual = TensorShape.dimensionRange(2, 5); int[] expected = new int[]{2, 3, 4}; assertArrayEquals(actual, expected); }