Commonly used numbers in computers are binary, octal, and hexadecimal. You need to know more about these commonly used numbers.
In decimal format, two Arabic numbers are used: 0 and 1;
8 digits: 0, 1, 2, 3, 4, 5, 6, and 7;
10 in hexadecimal notation, with 10 Arabic numerals: 0 to 9;
In hexadecimal notation, the number is 16 to 1, but we only have 0 ~ 9. Therefore, we use the letters A, B, C, D, E, and F to represent 10, 11, 12, 13, 14, and 15 respectively. Uppercase letters are not case sensitive.
The following describes the conversion methods between various hexadecimal formats:
I. Binary Conversion to decimal
Example: Binary "1101100"
1101100 bytes binary
6543210 Ranking Method
For example, the binary decimal conversion algorithm:
1*26 + 1*25 + 0*24 + 1*23 + 1*22 + 0*21 + 0*20
Zookeeper
Note: 2 indicates the base system, and the number behind it is the power (from right to left, starting with 0)
= 64 + 32 + 0 + 8 + 4 + 0 + 0
= 108
Ii. Binary Conversion octal
For example, the binary "10110111011"
For the October, from right to left, there are three groups, not enough to add 0, that is:
010 110 111 011
Then, the three numbers in each group correspond to the states of 4, 2, and 1 respectively, and then they are added as the States of 1, for example:
010 = 2
110 = 4 + 2 = 6
111 = 4 + 2 + 1 = 7
011 = 2 + 1 = 3
Result: 2673
Iii. Binary Conversion hexadecimal
The hexadecimal binary conversion method is similar as long as each group has four digits, corresponding to 8, 4, 2, and 1, for example:
0101 1011 1011
Operation:
0101 = 4 + 1 = 5
1011 = 8 + 2 + 1 = 11 (since 10 is A, 11 is B)
1011 = 8 + 2 + 1 = 11 (since 10 is A, 11 is B)
Result: 5BB
Iv. Convert binary to decimal
0th bits in binary are 0 to the power of 2, and 1st bits are 1 to the power of 2 ......
Therefore, there is a binary number: 0110 0100, which is converted to a 10-digit system:
Calculation: 0*20 + 0*21 + 1*22 + 1*23 + 0*24 + 1*25 + 1*26 + 0*27 = 100
5. Convert octal to decimal
In October, it means every 8 to 1.
The eight-digit number ranges from 0 ~ 7.
The 0th bits in eight dimensions are 0 to the power of 8, the 1st bits are 1 to the power of 8, and the 2nd bits are 2 to the power of 8 ......
Therefore, there is an octal digit: 1507, which is converted to decimal:
Computing: 7*80 + 0*81 + 5*82 + 1*83 = 839
The result is that the number of octal digits is 1507 to 839 in decimal format.
Vi. hexadecimal conversion to decimal
For example, 2af5 is converted to 10 hexadecimal.
Direct computing: 5*160 + F * 161 + A * 162 + 2*163 = 10997
(Don't forget, in the above calculation, a represents 10, and f Represents 15 ),
Now we can see that the key to converting all hexadecimal values into a decimal value is that their respective weights are different.
Suppose someone asks you, why is the ten-in-one number 1234 one thousand two hundred and thirty-four? You can give it a formula: 1234 = 1*103 + 2*102 + 3*101 + 4*100