surya
surya

Reputation: 41

Bitwise shift operator or ByteBuffer.wrap?

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

Answers (1)

Louis Wasserman
Louis Wasserman

Reputation: 198171

Probably the fastest way to convert a specific, say, int between big and little endian is Integer.reverseBytes.

Upvotes: 2

Related Questions