I need to convert binary octet string into byte array for writing into socket. ie i have to convert the octet string "00000010" into byte array with the value 00000010. How to do this?
Byte.parseByte("00000010",2) returns the binary value (that is, 2) as a byte. You will need to do this to every eight binary digits in your input and write them into each element of a byte array.
Thanks.. I want to write the integer 160 as binary string into a byte array. Am getting numberformat exception as the input argument is out of range of -128 to 127. pl help