List of utility methods to do Byte Array Reverse
byte[] | reverse(byte[] data) reverse for (int i = 0, j = data.length - 1; i < data.length / 2; i++, j--) { data[i] ^= data[j]; data[j] ^= data[i]; data[i] ^= data[j]; return data; |
byte[] | reverse(byte[] original) reverse byte[] result = new byte[original.length]; final int stop = original.length >> 1; byte x, y; for (int i = 0; i < stop; i++) { x = original[i]; y = original[original.length - i - 1]; if (0 != (x ^ y)) { x ^= y; ... |
void | reverseWord(byte[] b) reverse Word int len = 0; for (int i = b.length - 1; i >= 0; i--) { if ((b[i] & 0xff) != '\0') { len = i + 1; break; if ((len & 1) == 1) { ... |
void | reverseWordLatin(byte[] b) reverse Word Latin int len = 0; int size = b.length; for (int i = size - 1; i >= 0; i--) { if ((b[i] & 0xff) != '\0') { len = i + 1; break; for (int i = 0; i < len / 2; i++) { byte tmp = b[i]; b[i] = b[size - 1 - i]; b[size - 1 - i] = tmp; |
byte[] | reverse(byte[] byteArray) reverse byte[] rev = new byte[byteArray.length]; for (int i = 0; i < byteArray.length; i++) { rev[byteArray.length - (i + 1)] = byteArray[i]; return rev; |
byte[] | reverseBytes(byte[] bytes) Returns a copy of the given byte array in reverse order. byte[] buf = new byte[bytes.length]; for (int i = 0; i < bytes.length; i++) buf[i] = bytes[bytes.length - 1 - i]; return buf; |
int | getReverseBytesInt(byte[] bb, int index) get Reverse Bytes Int return (int) ((((bb[index + 3] & 0xff) << 24) | ((bb[index + 2] & 0xff) << 16) | ((bb[index + 1] & 0xff) << 8) | ((bb[index + 0] & 0xff) << 0))); |
long | getReverseBytesLong(byte[] bb, int index) get Reverse Bytes Long return ((((long) bb[index + 7] & 0xff) << 56) | (((long) bb[index + 6] & 0xff) << 48) | (((long) bb[index + 5] & 0xff) << 40) | (((long) bb[index + 4] & 0xff) << 32) | (((long) bb[index + 3] & 0xff) << 24) | (((long) bb[index + 2] & 0xff) << 16) | (((long) bb[index + 1] & 0xff) << 8) | (((long) bb[index + 0] & 0xff) << 0)); |
short | getReverseBytesShort(byte[] b, int index) get Reverse Bytes Short return (short) (((b[index + 1] << 8) | b[index] & 0xff)); |
byte[] | invertedByteArray(byte[] byteArr) inverted Byte Array final int size = byteArr.length; byte temp; for (int i = 0; i < size / 2; i++) { temp = byteArr[size - 1 - i]; byteArr[size - 1 - i] = byteArr[i]; byteArr[i] = temp; return byteArr; ... |