List of utility methods to do Zigzag Encode
byte[] | zigzagEncode(byte[] data) zigzag Encode byte[] result = new byte[64]; for (int i = 0; i < naturalOrder.length; i++) { result[i] = data[naturalOrder[i]]; return result; |
int | zigZagEncode(int i) Same as #zigZagEncode(long) but on integers. return (i >> 31) ^ (i << 1);
|
int | zigzagEncode(int input) zigzag Encode return (input << 1) ^ (input >> 31);
|
int | zigzagEncode(int input) zigzag Encode if (input < 0) { return (input << 1) ^ -1; return (input << 1); |
long | zigZagEncode(long l) Zig-zag encode the provided long. return (l >> 63) ^ (l << 1);
|
long | zigZagEncode(long n) Zig-zag encode: this helps transforming small signed numbers into small positive numbers. return (n >> 63) ^ (n << 1);
|
long | zigzagEncode(long val) zigzag encode the given value return (val << 1) ^ (val >> 63); |
int[] | zigZagSort(int[] array) Sort an array in zig-zag pattern i.e. for (int i = 1; i < array.length; i++) { if ((i % 2 == 1 && array[i] < array[i - 1]) || (i % 2 == 0 && array[i] > array[i - 1])) { int temp = array[i]; array[i] = array[i - 1]; array[i - 1] = temp; return array; ... |
int | zigzagToInt(final int n) zigzag To Int return (n >>> 1) ^ -(n & 1);
|