[New] New ByteHelper.reverse()
This commit is contained in:
parent
5640df965a
commit
0b62acc4f3
|
@ -224,6 +224,16 @@ public class ByteHelper {
|
||||||
return new byte[] { low, high };
|
return new byte[] { low, high };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte reverse(byte x) {
|
||||||
|
byte b = 0;
|
||||||
|
for (int i = 0; i < 8; ++i) {
|
||||||
|
b <<= 1;
|
||||||
|
b |= (x & 1);
|
||||||
|
x >>= 1;
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats the given byte array to a binary string, separating each byte by a space
|
* Formats the given byte array to a binary string, separating each byte by a space
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue