bit manipulation in java

Posted by sarav on Stack Overflow See other posts from Stack Overflow or by sarav
Published on 2010-05-29T17:41:00Z Indexed on 2010/05/29 17:42 UTC
Read the original article Hit count: 413

Filed under:
|
|

I have a fragment of bytes in a byte[]. The total size of the array is 4 and I want to convert this into a positive long number. For example if the byte array is having four bytes 101, 110, 10, 1 then i want to get the long number represented by binary sequence

00000000 00000000 00000000 00000000 00000101 00000110 00000010 00000001

which equals 84279809

What is the efficient way to do that in Java?

© Stack Overflow or respective owner

Related posts about java

Related posts about byte