src/org/kocakosm/pitaya/util/XArrays.java
public static long[] rotate(long[] a, int distance)
	{
		int len = a.length;
		long[] copy = new long[len];
		for (int i = 0; i < len; i++) {
			copy[i] = a[index(i - distance, len)];
		}
		return copy;
	}
public static long[] rotate(long[] a, int distance)
	{
		int len = a.length;
		long[] copy = new long[len];
		for (int i = 0; i < len; i++) {
			copy[i] = a[index(i - distance, len)];
		}
		return copy;
	}
Returns a new array containing the same elements as the given one,
but rotated by the given distance. The element at index {@code i} in
the returned array corresponds to the element in the original array
at index {@code (i - distance)} mod {@code a.length}, for all values
of {@code i} between {@code 0} and {@code a.length - 1}, inclusive.
Note that rotation by {@code 0} or by a multiple of {@code a.length}
is a no-op.

@param a the array to rotate.
@param distance the distance to rotate.

@return the rotated array.

@throws NullPointerException if {@code a} is {@code null}.