I have a ASCII encoded string that looks like 3030. Each character in the ascii string needs to be converted into a 4 bit sequence and concatenated together to form a 16 bit sequence, with 4 bit padding.
For eg: 3030 should be converted into
0011 0000 0011 0000
(Spaces added for readability).
I'm aware that we can cast each character to a byte and and do String format operations to get the binary representation as a string. But I would want to retain the binary format because I want to do further masking on it.
Is there a way to get this byte output in java?