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!

Converting Integers/Binary String to bytes

807603Dec 2 2007 — edited Dec 2 2007
Hi, i need some help changing some integers to bytes to use in a byte array.

A few questions:

If I have a string say "01010101" how can i change this to a byte?

Secondly,

How can i change a 16bit integer to two bytes?

And Finaly, how do i change a 32 bit integer into 4 bytes?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 30 2007
Added on Dec 2 2007
3 comments
194 views