Here you can find the source of slice(T[] array, int index)
public static <T> List<T[]> slice(T[] array, int index)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static <T> List<T[]> slice(T[] array, int index) { List<T[]> arrayList = new ArrayList<T[]>(); T[] slice1 = Arrays.copyOfRange(array, 0, index); T[] slice2 = Arrays.copyOfRange(array, index, array.length); arrayList.add(slice1);//from ww w. j av a 2 s . c om arrayList.add(slice2); return arrayList; } }