@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] newArray ( final T [ ] oldElements , final int length ) { return ( T [ ] ) Array . newInstance ( oldElements . getClass ( ) . getComponentType ( ) , length ) ; }
Allocate a new array of the same type as another array .