code: public static void rotateArray(double[] a, final int size, final int offset, int distance){
  		// this is a copy of Collections.rotate1(...) for double[]
  		if (size == 0)
  			return;
  		distance = distance % size;
  		if (distance < 0)
  			distance += size;
  		if (distance == 0)
  			return;
  
  		for (int cycleStart = 0, nMoved = 0; nMoved != size; cycleStart++) {
  			double displaced = a[cycleStart+offset];
  			int i = cycleStart;
  			do {
  				i += distance;
  				if (i >= size)
  					i -= size;
  				double t=a[i+offset];
  				a[i+offset]=displaced;
  				displaced=t;
  				nMoved ++;
  			} while (i != cycleStart);
  		}
  	}
docs: This is a copy of {@link Collections#rotate1(java.util.List, int)} for double[]
  with capability of rotating only a specific part of the array.
  @param a array to rotate (within)
  @param size of the part to rotate
  @param offset into the array to the starting index of the part that is rotated
  @param distance to rotate (how many elements to the right)