|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
Integer.reverseBytes() implements endianness conversion as:
public static int reverseBytes(int i) {
return ((i >>> 24) ) |
((i >> 8) & 0xFF00) |
((i << 8) & 0xFF0000) |
((i << 24));
}
Some architectures include instructions that do just that: BSWAP on x86 and LDUWA on SPARC, but HotSpot currently does not take advantage of them.
Similarly for Long.reverseBytes().
|