public static < T > T [ ] slice ( T [ ] array , int ... indexes ) { int length = indexes . length ; T [ ] slice = ObjectArrays . newArray ( array , length ) ; for ( int i = 0 ; i < length ; i ++ ) { slice [ i ] = array [ indexes [ i ] ] ; } return slice ; }
Get the elements in the array that are at the indexes .