比如说
1(0000 0001) 为1
2(0000 0010) 为2
4(0000 0100) 为3
8(0000 1000) 为4
16 5
·
·
·
2048 11
依次往下
Ok just I am telling you the short trick to find out the binery number of any degit
lets start from the heigher amount you have:
suppose it you want to find out the binery of 165
128 64 32 16 8 4 2 1
write the above series as I have written in decreasing order, it will be continue untill you don't find your binery,
start counting now how.......
1 0 1 0 0 1 0 1
128 64 32 16 8 4 2 1
now add the the number below the degit one
128+32+4+1=165 (10100101)
The remaining number will be called the (0)
Hope you understand it.
Thanks
http://www.html5andcss3.org
如果仅是1、2、4、8、16、32这种2的幂级数的话。可以按下面的公式来算:
其中,n就是你输入的数。
是把二进制的字符串转换成数字吗?Convert类里面就有专门的函数干这个的,如下就是一个例子。
Convert.ToInt32("00001000", 2);