Reputation: 41
Currently I am working on Big/Little Endian conversions and I am using bitwise operators. When I searched on the web, many have implemented with ByteBuffer.wrap()
. I have never used ByteBuffer
before, how efficient is it when compared to bitwise operators? Which is better performance wise?
Upvotes: 2
Views: 602
Reputation: 198171
Probably the fastest way to convert a specific, say, int
between big and little endian is Integer.reverseBytes
.
Upvotes: 2