Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get the bytes of a long?

807603Oct 31 2007 — edited Oct 31 2007
Hi,

I need an 8-byte number for my application. First I create an int and then cast it to long. After that this long number must be represented by 8 bytes, or 64 bits, in memory. As far as I know the leading zeros in its binary representation are present, even though they mean nothing. However, I need to get those 8 bytes and put them in a byte array. And I need all 8 bytes, no matter what their values are. Can anyone tell me what the easiest way to that is? Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2007
Added on Oct 31 2007
15 comments
494 views