I have a string of ones and zeros that I want to convert to an array of bytes.
For example String b = "0110100001101001"
How can I convert this to a byte[]
of length 2?
Parse it to an integer in base 2, then convert to a byte array. In fact, since you've got 16 bits it's time to break out the rarely used
|
|||||||||||||||||||||
|
Another simple approach is:
|
|||||
|
104
in position 0, and105
in position 1? – Saviour Self Jul 18 '13 at 15:18