I frequently see see novice programmers asking “how to change variable from hex to binary” or similar questions. Leaving aside the simple number base conversion, these questions are, frustratingly, usually about not understanding fundamental computing concepts.
Purely as an 8 bit binary number with the least significant bit on the right, this is the same as
- decimal 42 (32 + 8 + 2)
- hexdecimal 2A (0010 1010)
- octal 052 (00 101 010)
Importantly, if this is eight bits of a byte, there is no conversion as the alternative number bases are simply representations of the underlying bit pattern.
However, the binary string can also be the ASCII character ‘*’, because this character has been given the code 42. So ‘*’ is just another representation of the same underlying bit pattern.
Or it can represent a number of on/off status values accessed as a bit mask, so that each bit digit has its own special meaning.
Or any of an infinite number of other combinations of things.
So what is 00101010? It is whatever meaning you give it. As a programmer you provide context and this may change in the flow of your code.