Conversion between particular systems seems to be not necessary nowadays, what may be pernicious. Besides, for any IT guy it’s a shame don’t know how to make simple math that sometimes may be really helpful.
In each of conversion that I am going to show we will be using “weights“.
The string of “weights” is nothing more than sequentially multiplied numbers by 2 , that starts with 1.
Decimal to Binary
We want to convert number 89, using “weights” we make below table and from the left we try to squueze particular numbers up to the moment when we get 89. If number is needed we put “1” if not “0”. The lowest number that match to 89 is 64 and we start calculation with this number. So, for 89 it look in this way:
89= 1011001
because 64+16+8+1=89 !
Binary to Decimal
Let’s take the number 110011001. With using “weights”, calculation of binary number proceeds in this way. If there is a “1” in the binary number you have to add appropriate number from “weights” string, if there is a “0” you don’t take it into consideration.
110011001=409
because 1+8+16+128+256=409!
Binary to Hexadecimal
In hexadecimal system we write down numbers using 0-9 and A to F what gives 16 numbers. For A stand 10, B stands 11 and so on …
Numbers from 0 to 15 we may write down using 4 bits what gives us “weights” 8,4,2,1 and these weights we will be using to conversion.
If we can write down number 0 to 15 by using 4 bits, we divide any number that we are going to convert on 4 numbers groups. Assuming we have number 1011001101011101 and we divide in this way:
1011 0011 0101 1101= B35D
Hexadecimal to Binary
Similar to Binary to Hexadecimal but we do that conversly. We still operate on 4 bits and “weights” 8,4,2,1. So there is a number A8FD. We may use the table above or calculate ourselves. We know that A=10, F=15, D=13 and 8=8 . Then we have to convert binary to hexadecimal. So we calculate :