Binary, octal, decimal, and hexadecimal are different ways to write the same integer. Conversion is helpful when reading bitmasks, color values, memory addresses, and low-level output.
Convert the value and check its base
A string such as 10 means different values in binary, decimal, and hexadecimal. Always identify the input base before interpreting the digits.
- Enter the integer value.
- Set the base the value is currently written in.
- Read the equivalent representations in the other bases.
- Check that the output fits the expected signed or unsigned range in your application.
Keep in mind: Leading zeros can matter in fixed-width formats even when they do not change the mathematical value.