public static < T > T [ ] concatenate ( final T [ ] first , final T [ ] ... rest ) { int totalLength = first . length ; for ( final T [ ] array : rest ) { totalLength += array . length ; } final T [ ] ret = Arrays . copyOf ( first , totalLength ) ; int offset = first . length ; for ( final T [ ] array : rest ) { System . arraycopy ( array , 0 , ret , offset , array . length ) ; offset += array . length ; } return ret ; }
Concatenates the specified arrays .