Java Array Shift shift(int[] v, int n)

Here you can find the source of shift(int[] v, int n)

Description

shift

License

Open Source License

Declaration

public final static void shift(int[] v, int n) 

Method Source Code

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

Related

  1. shift(double[] x, int N)
  2. shift(final byte[] input, final int amount)
  3. shift(final double[] values, final double constant)
  4. shift(final Object[] array, int offset)
  5. Shift(int[] in, int amt, int spare)
  6. shift(int[][] array, boolean inverse)
  7. shift(Object a[], int count)
  8. shift(String[] args, int count)
  9. shift(String[] array)