public static <T>T[] copyFrom(T[] array,int newLength){
  T[] copy=createWithSameComponentType(newLength,array);
  System.arraycopy(array,0,copy,0,Math.min(array.length,newLength));
  return copy;
}

public static < T > T [ ] copyFrom ( T [ ] array , int newLength ) { T [ ] copy = createWithSameComponentType ( newLength , array ) ; System . arraycopy ( array , 0 , copy , 0 , Math . min ( array . length , newLength ) ) ; return copy ; }
creates a new array with the given length , and of the same type as the given array .
