3.5.4+Number+base+conversion+(includes+converter)

=__**Conversion of numbers between different bases**__= __Method 1__ Converting decimals into binary can be done by dividing the decimal number by two continuously and looking at the remainder. (Divide by two because binary numbers are numbers of the base of two).
 * __Decimal → binary__**

For example: converting 54 into binary: 54÷2 = 27 (remainder = 0) 27÷2 = 13 (remainder = 1) 13÷2 = 6 (remainder = 1) 6÷2 = 3 (remainder = 0) 3÷2 = 1 (remainder = 1) 1÷2 = 0 (remainder = 1)

Now, reading the remainders from bottom to top one reads: 110110, which is the binary value of 54.

__Method 2__ A short video demonstrating how you can convert decimal numbers to binary manually: media type="youtube" key="qWxiXU02ZQM" height="390" width="640"

__**Binary → decimal**__ This video illustrates how to convert binary to decimal numbers: media type="youtube" key="UUqtjb8WEUs" height="390" width="640"

In the hexadecimal number system there are 16 different values, that can be represented using one character. (In binary there are 2 different values (i.e. 0 and 1), in the decimal system there are 10 different values (i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)):
 * __Binary → hexadecimal__**
 * = Decimal ||= Binary ||= Hexadecimal ||
 * = 0 ||= 00000000 ||= 00 ||
 * = 1 ||= 00000001 ||= 01 ||
 * = 2 ||= 00000010 ||= 02 ||
 * = 3 ||= 00000011 ||= 03 ||
 * = 4 ||= 00000100 ||= 04 ||
 * = 5 ||= 00000101 ||= 05 ||
 * = 6 ||= 00000110 ||= 06 ||
 * = 7 ||= 00000111 ||= 07 ||
 * = 8 ||= 00001000 ||= 08 ||
 * = 9 ||= 00001001 ||= 09 ||
 * = 10 ||= 00001010 ||= 0A ||
 * = 11 ||= 00001011 ||= 0B ||
 * = 12 ||= 00001100 ||= 0C ||
 * = 13 ||= 00001101 ||= 0D ||
 * = 14 ||= 00001110 ||= 0E ||
 * = 15 ||= 00001111 ||= 0F ||
 * = 16 ||= 00010000 ||= 10 ||
 * = 17 ||= 00010001 ||= 11 ||
 * = 27 ||= 00011011 ||= 1B ||
 * = 50 ||= 00110010 ||= 32 ||
 * = 171 ||= 10101011 ||= AB ||
 * = 128 ||= 10000000 ||= 80 ||
 * = 255 ||= 11111111 ||= FF ||

To convert binary numbers to hexadecimal numbers, one can group the binary number in sets of four bits and convert these groups of bits to hexadecimal numbers individually (see table above). When grouping the bits, always start from the right of the binary number. If there are less than four bits left over on the very left, after grouping all the rest of the 1s and 0s, place enough 0s in front of the left bits to make the number of bits 4. (This doesn't change the value of the binary number, since zeros in front of the number will not have an effect on the value. For example: 10110101011101 Grouping this into sets of four bits: 10 1101 0101 1101 Note that the group of bits on the left consists of only two numbers. Therefore fill it up with zeros in front, to make it a group of four: 0010 1101 0101 1101. Now, one can convert these groups of 4 bits according to the table above, to make 2DAD

__**Hexadecimal → binary**__ Do the exact opposite of what you did when converting from binary to hexadecimal. This time look at the binary numbers representing the hexadecimal values and rewrite accordingly. For example. 5D3AD → 0101 1101 0011 1010 1101 → 1011101001110101101

media type="custom" key="8732560"

Last edit by: Jocbe Last update: 15. March 2011

Sources:
 * Ajbsharing. "Binary: Converting Binary to Decimal (part 2 of 2)." YouTube - Broadcast Yourself. 29 Jan. 2009. Web. 15 Mar. 2011. .
 * Ajbsharing. "Binary: Converting Decimal to Binary (part 1 of 2)." YouTube - Broadcast Yourself. 29 Jan. 2009. Web. 15 Mar. 2011. .
 * Jones, Richard. Computer Science Java Enabled. Victoria: IBID Press, 2004.