I am having following hexadecimal address : 2001:0db8:3c4d:0015:0000:0000:abcd:ef12. There are 8 blocks of hexadecimal digits, each block is 16 bits long, total 128-bits. I want to convert each of these blocks into binary, i.e if I take the 1st block – 2001, than I want to convert it to binary and than take the 2nd block – 0db8, convert it to binary and so on…..
Likewise I need to iterate through each block, convert them to binary and then pack them.
Can anyone tell me the most simplest way in which I can achieve it?
Best Solution
Output:
EDIT
Following lines are culprit in your code. Try removing them.