java cut array code example
Example 1: array slice java
int[] newArray = Arrays.copyOfRange(oldArray, startIndex, endIndex);
Example 2: take a peice from array java
import java.util.IntStream;
// for java 8 and 8+
IntStream.range(start, end).map(x -> arr[x]).toArray();