Here you can find the source of shift(int[] v, int n)
public final static void shift(int[] v, int n)
//package com.java2s; public class Main { public final static void shift(int[] v, int n) { int[] copy = new int[v.length]; for (int i = 0; i < v.length; i++) copy[i] = v[(i + n + v.length) % v.length]; System.arraycopy(copy, 0, v, 0, v.length); }//from w w w . j a v a2s .co m }