Check out example codes for "array slice java". It will help you in understanding the concepts better.

Code Example 1

int[] newArray = Arrays.copyOfRange(oldArray, startIndex, endIndex);

Code Example 2

import java.util.IntStream;
// for java 8 and 8+
IntStream.range(start, end).map(x -> arr[x]).toArray();

Learn ReactJs, React Native from akashmittal.com