Java Array Shift shiftRight2(T[] array, int to)

Here you can find the source of shiftRight2(T[] array, int to)

Description

shift Right

License

BSD License

Declaration

public static <T> void shiftRight2(T[] array, int to) 

Method Source Code

//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;
    }
}

Related

  1. shiftRight(byte[] x)
  2. shiftRight(int[] result, int[] vec, int shift)
  3. shiftRight(int[] x)
  4. shiftRight(Object[] array, final int amount)
  5. shiftRight(T[] array)
  6. shiftRightN(int[] block, int n)
  7. shiftRightN(int[] block, int n)
  8. shiftRightN(int[] x, int n)
  9. shiftRightState(int[] state)