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!

binary representation of an integer from String to byte in encoding

807589Jun 25 2008 — edited Jun 25 2008
hi


I am facing the problem of converting the binary string representation of integer to a byte... for example number 5-"101" can be stored in one byte rather than 3 bytes. so how can i do this..

My piece of code...

String s = Integer.toBinaryString(int i);

I have to convert that string s into one byte if it is <128 and 2 bytes if it is > 128 <16384...so that i can compress the seq of integers to a great extent.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2008
Added on Jun 25 2008
7 comments
851 views