Here you can find the source of shiftRight2(T[] array, int to)
public static <T> void shiftRight2(T[] array, int to)
//package com.java2s; /**//from www . j av a 2 s . c om * This class is part of JCodec ( www.jcodec.org ) This software is distributed * under FreeBSD License * * @author Jay Codec * */ public class Main { public static <T> void shiftRight2(T[] array, int to) { shiftRight3(array, 0, to); } public static <T> void shiftRight3(T[] array, int from, int to) { for (int i = to - 1; i > from; i--) { array[i] = array[i - 1]; } array[from] = null; } }