Java examples for Language Basics:Array
Shifting Elements in an Array
public class Main { public void m() { int[] array = null; // Shift all elements right by one System.arraycopy(array, 0, array, 1, array.length-1); // Shift all elements left by one System.arraycopy(array, 1, array, 0, array.length-1); }/*w w w.ja v a 2s . c om*/ }