Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Binary conversion: the secret of binary conversion to hexadecimal
Binary conversion: the secret of binary conversion to hexadecimal
Binary conversion is the basic knowledge in computer science and an indispensable part of programming language. This paper will introduce the conversion methods between binary, octal and hexadecimal and decimal, hoping to help you understand this formula better.

Binary conversion formula

Binary, octal and hexadecimal can all be converted into decimal. The method is to multiply each number by the N- 1 power of their respective cardinality, and then add them to get the corresponding decimal number.

Binary to decimal

For example, when the binary number 1 10B is converted into decimal, it is1* 2+1* 20 = 4+2+0 = 6d.

Decimal to binary

Conversely, decimal can also be converted into binary, octal and hexadecimal. The method is to divide by the number to be converted and write down the remainder of each time until the remainder is 0.

Octal to decimal

For example, 100D is converted into octal, which is 144Q, where100/8 =12/8 =1... 41/8 = 0 ... 66.

Hexadecimal to decimal

Similarly, hexadecimal can also be converted into decimal. This method is similar to binary and octal, but the radix is changed to 16.