Java Utililty Methods Array Shift

List of utility methods to do Array Shift

Description

The list of methods to do Array Shift are organized into topic(s).

Method

voidshiftRightN(int[] block, int n)
shift Right N
int i = 0;
int bits = 0;
for (;;) {
    int b = block[i];
    block[i] = (b >>> n) | bits;
    if (++i == 4) {
        break;
    bits = b << (32 - n);
intshiftRightN(int[] x, int n)
shift Right N
int b = x[0], nInv = 32 - n;
x[0] = b >>> n;
int c = b << nInv;
b = x[1];
x[1] = (b >>> n) | c;
c = b << nInv;
b = x[2];
x[2] = (b >>> n) | c;
...
intshiftRightState(int[] state)
shift Right 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;
String[]shiftStringArray(String[] input)
Remove the first entry in the String array
String[] output = new String[input.length - 1];
System.arraycopy(input, 1, output, 0, input.length - 1);
return output;
String[]unshift(String[] array, String newElem)
prepends newElem to the array, shifting all elements one index up.
List arr = new ArrayList(Arrays.asList(array));
arr.add(0, newElem);
return (String[]) arr.toArray(new String[0]);