http://blog.163.com/kongdelu2009@yeah/blog/static/111995207201037105051259/
If you are engaged in networking, I think you must remember the following conversion values of binary numbers. You are a network engineer. When you see a string of binary numbers, don't tell me that you will take out a pen and paper or break your fingers for a long time to know it is converted into a decimal value. To be quick, write down the following common binary-to-decimal conversions:
Demonstrated in 8 bits :
1. The first type:
00000001 1
00000010 2
00000100 4
00001000 8
00010000 16
00100000 32
01000000 64
10000000 128
2. The second :
000000011
000000113
00000111 7
00001111 15
00011111 31
00111111 63
01111111 127
3. The third type:
10000000 128
11000000 192
11100000 224
11110000 240
11111000 248
11111100 252
11111110 254
For example: 11101011
It can be divided into:
11100000 (the third type above) 224
00001000 (the first type above) 8
00000011 (the second type above) 3
We get the result immediately by remembering the above three types of conversions, and then using addition (you can count the addition mouth): 235
==================================================================================
Method Two:
It is actually very easy to memorize the following arrangement. From right to left, the order is twice the previous number:
256 128 64 32 16 8 4 2 1
随便写个数字比如48
48 = 32 + 16,所以在32 和 16所在的位置为1,其余为0,
转为2进制就是
256 128 64 32 16 8 4 2 1
0 0 0 1 1 0 0 0 0
二进制转十进制就更简单了,
比如随便写的一串 01111101
先写上 : 0 1 1 1 1 1 0 1
然后填充 128 64 32 16 8 4 2 1
十进制为 64+32+16+8+4+1=125