Java Array Shift shiftRightState(int[] state)

Here you can find the source of shiftRightState(int[] state)

Description

shift Right State

License

Open Source License

Declaration

public static final int shiftRightState(int[] state) 

Method Source Code

//package com.java2s;
/*//from   w w w .  jav a2s  .com
 * Copyright 2001-2008 Aqris Software AS. All rights reserved.
 * 
 * This program is dual-licensed under both the Common Development
 * and Distribution License ("CDDL") and the GNU General Public
 * License ("GPL"). You may elect to use one or the other of these
 * licenses.
 */

public class Main {
    public static final int shiftRightState(int[] state) {
        int returnValue = state[state.length - 1];
        for (int i = state.length - 1; i > 0; i--) {
            state[i] = state[i - 1];
        }
        state[0] = 0;
        return returnValue;
    }
}

Related

  1. shiftRight(T[] array)
  2. shiftRight2(T[] array, int to)
  3. shiftRightN(int[] block, int n)
  4. shiftRightN(int[] block, int n)
  5. shiftRightN(int[] x, int n)
  6. shiftStringArray(String[] input)
  7. unshift(String[] array, String newElem)