Given the decimal 71744474
in binary it is 0100010001101011101111011010
what I am trying to extract from this decimal is every seven bits starting from the lower bits. Each of the seven bits are to represent a printable ASCII character which can only have 7 bits. In total I am pulling out four characters. The first character is 1011010
which is Z
in ASCII. The next character is w
and so on. I am thinking there is a way to mask out the bits I care about some how.
Use bitwise operators:
0100010001101011101111011010 & 0000000000000000000001111111 = 1011010
To get the second character, do
0100010001101011101111011010 & 0000000000000011111110000000
and so on..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With