Java - Need help with binary/code string manipulation

Posted by ShrimpCrackers on Stack Overflow See other posts from Stack Overflow or by ShrimpCrackers
Published on 2010-06-13T07:43:54Z Indexed on 2010/06/13 7:52 UTC
Read the original article Hit count: 222

Filed under:
|

For a project, I have to convert a binary string into (an array of) bytes and write it out to a file in binary.

Say that I have a sentence converted into a code string using a huffman encoding. For example, if the sentence was: "hello" h = 00 e = 01, l = 10, o = 11

Then the string representation would be 0001101011.

How would I convert that into a byte? <-- If that question doesn't make sense it's because I know little about bits/byte bitwise shifting and all that has to do with manipulating 1's and 0's.

© Stack Overflow or respective owner

Related posts about java

Related posts about huffman