src/org/kocakosm/pitaya/util/XArrays.java
public static <T> T[] copyOf(T[] a, int off, int len)
	{
		T[] copy = newArray(a.getClass().getComponentType(), len);
		if (len > a.length - off) {
			System.arraycopy(a, off, copy, 0, a.length - off);
		} else {
			System.arraycopy(a, off, copy, 0, len);
		}
		return copy;
	}
public static <T> T[] copyOf(T[] a, int off, int len)
	{
		T[] copy = newArray(a.getClass().getComponentType(), len);
		if (len > a.length - off) {
			System.arraycopy(a, off, copy, 0, a.length - off);
		} else {
			System.arraycopy(a, off, copy, 0, len);
		}
		return copy;
	}
Copies the specified range of elements from the given array into a
new array. The returned array will be padded with {@code null}, if
necessary, so that it has an exact length of {@code len}.

@param <T> the type of the elements in the array to copy.
@param a the source array.
@param off the starting position in the source array.
@param len the number of elements to copy (returned array's length).

@return a new array containing the specified range of the source array.

@throws NullPointerException if {@code a} is {@code null}.
@throws ArrayIndexOutOfBoundsException if {@code off} is negative.
@throws NegativeArraySizeException if {@code len} is negative.