I would like to know what is a general rule of thumb to convert between the following number systems:
Decimal
Octal
Hexadecimal
Binary
I know if I want to convert from octal to hexadecimal, I first convert the octal number to binary with groups of 3 bits and then I regroup the binary number to groups of 4 bits, starting from the right to left. Finally, I convert the binary number to hexadecimal by adding up the bit values.
I know if I want to convert from decimal to binary, I can just divide the decimal number by 2 and keep track of the remainder until the quotient is 0. The answer will be the remainders from the most significant bit to the least significant bit.
Because there are so many number systems to convert between, decimal to binary to octal to hexadecimal etc, I sometimes forget which method to use for which conversion.
I figured that if I need to convert from decimal that I just need to divide by the base of the number system which I'm converting to. For example, from decimal to binary, divide by 2 and keep track of the remainders for each calculations and from decimal to octal divide by 8, etc. This makes it easy to understand if I convert from decimal. I need some rule like this for all conversions.
How can I always know which method to use. Is there a general rule of thumb?
Thank you.