code: public static <T> T[] arrayCopyOf(T[] array, int newSize) {
  		@SuppressWarnings("unchecked")
  		T[] newArr = (T[]) Array.newInstance(array.getClass().getComponentType(), newSize);
  		System.arraycopy(array, 0, newArr, 0, Math.min(newSize, newArr.length));
  		return newArr;
  	}
docs: Utility method similar to Java 1.6 Arrays.copyOf, used instead of that method to stick to Java 1.5 only API.
  
  @param <T> the type of the array entries
  @param array the array to copy
  @param newSize the size of the new array
  @return a new array of the specified size containing the supplied array elements at the beginning