List of utility methods to do Array Swap
void | swap(boolean[] array, int i1, int i2) Swaps two elements of a vector boolean temp = array[i1];
array[i1] = array[i2];
array[i2] = temp;
|
void | swap(byte size, byte[] target, short targetOffset, byte[] a, short aOffset) swap for (byte i = 0; i < size; i++) { target[(short) (targetOffset + size - 1 - i)] = a[(short) (aOffset + i)]; |
byte[] | swap(byte[] b1) swap for (int i = 0; i < (b1.length - 4); i = i + 4) { byte temp = b1[i]; b1[i] = b1[i + 1]; b1[i + 1] = b1[i + 2]; b1[i + 2] = b1[i + 3]; b1[i + 3] = temp; return b1; ... |
byte[] | swap(byte[] buffer, int i, int j) swap final byte[] result = buffer.clone(); final byte c = result[i]; result[i] = result[j]; result[j] = c; return result; |
void | swap(byte[] bytes) swap int half = bytes.length / 2; for (int i = 0; i < half; i++) { byte temp = bytes[i]; bytes[i] = bytes[half + i]; bytes[half + i] = temp; |
byte[] | swap(byte[] data) swap int count = data.length; byte[] result = new byte[count]; for (int i = 0; i < count; i++) { result[i] = data[count - 1 - i]; return result; |
void | swap(byte[] data, int p, int q) swap int len = data.length * 8; for (int i = 0; i < len; i += p) { int j = i + q; if (j < len) { byte b1 = data[i / 8]; byte b2 = data[j / 8]; int f1 = b1 & (1 << (i % 8)); int f2 = b2 & (1 << (j % 8)); ... |
byte[] | swap(byte[] rv, int offsetA, int offsetB) swap byte tmp = rv[offsetA]; rv[offsetA] = rv[offsetB]; rv[offsetB] = tmp; return rv; |
void | swap(Comparable[] a, int oldIndex, int newIndex) swap Comparable t = a[oldIndex]; a[oldIndex] = a[newIndex]; a[newIndex] = t; |
void | swap(double x[], Object[] corr, int a, int b) swap final double tmpX = x[a]; x[a] = x[b]; x[b] = tmpX; final Object tmpCorr = corr[a]; corr[a] = corr[b]; corr[b] = tmpCorr; |