List of utility methods to do Array Shift
String[] | shiftArray(String[] args, int shift) shift Array if (args.length > shift) { String[] shiftedArgs = new String[args.length - shift]; for (int i = 0; i < shiftedArgs.length; ++i) { shiftedArgs[i] = args[i + shift]; return shiftedArgs; return null; ... |
String[] | shiftArray(String[] array, int offset) Shift an array forward a number of elements String[] newArray = new String[array.length - offset]; int j = 0; for (int i = offset; i < array.length; i++) { newArray[j] = array[i]; j++; return newArray; |
int | ShiftAwayTrailingZerosTwoElements(int[] arr) Shift Away Trailing Zeros Two Elements int a0 = arr[0]; int a1 = arr[1]; int tz = CountTrailingZeros(a0); if (tz == 0) { return 0; if (tz < 32) { ... |
float[] | shiftChroma(float[] chroma, int step) shift Chroma float[] result = new float[12]; if (step < 0) { step = 12 - step; for (int i = 0; i < 12; i++) { result[i] = chroma[(i + step) % 12]; return result; ... |
E | shiftEnum(E current, E[] values, int delta) shift Enum int next = current.ordinal() + delta; if (next < 0) { return values[(values.length - 1)]; if (next >= values.length) { return values[0]; return values[next]; ... |
void | shiftLeft(byte[] array) shift Left if (array.length <= 1) return; System.arraycopy(array, 1, array, 0, array.length - 1); |
byte[] | shiftLeft(byte[] b1, int bytes) Shifts a byte-array a number of bytes to the left byte[] result = new byte[b1.length]; System.arraycopy(b1, bytes, result, 0, bytes); return result; |
int | shiftLeft(byte[] block, byte[] output) Code taken from org.bouncycastle.crypto.macs.CMac int i = block.length; int bit = 0; while (--i >= 0) { int b = block[i] & 0xff; output[i] = (byte) ((b << 1) | bit); bit = (b >>> 7) & 1; return bit; ... |
byte[] | shiftLeft(byte[] data, int shiftBy) Shifts a whole byte array to the left by the specified amount. if (0 > shiftBy || shiftBy > 8) throw new IllegalArgumentException("Invalid shiftBy(" + shiftBy + ") argument, allowed values: 0-8"); if (shiftBy == 0) return data; byte rest = 0; for (int i = 0; i < data.length; ++i) { rest = (byte) (getBits(data[i], shiftBy - 1, shiftBy) << 8 - shiftBy); data[i] = (byte) ((data[i] & 0xFF) >>> shiftBy); ... |
void | shiftLeft(Object[] arr, int startIndex, int endIndex) overwrites left cell with right cell. for (int i = startIndex; i < endIndex; i++) { arr[i - 1] = arr[i]; |