I have a StringBuffer,strbuf=161656070200000000202020202001000000009E52;.
I want to convert into a byte array that looks like this:
byte[] byte_array=new byte[]
{(byte)0x16,(byte)0x16,(byte)0x56,(byte)0x07,
(byte)0x02,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x20,(byte)0x20,(byte)0x20,
(byte)0x20,(byte)0x20,(byte)0x01,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x9E,(byte)0x52};
Do I need to convert strbuf to hex string and then do getBytes()?
What is the right approach to this problem?