100分 急求在vb.net中怎样进行位操作
由于项目需要,需要对两个16进制的数进行与、或的操作。
[解决办法]
这和2进制,10进制的按位运算有什么区别么??
[解决办法]
And 运算符 (Visual Basic)
Not 运算符 (Visual Basic)
Or 运算符 (Visual Basic)
Xor 运算符 (Visual Basic)
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
[解决办法]
同意
111100111111 |0F3FH
and 100010011000 |0898H
= 100000011000 |0818H
100000011000 |0818H
and 000000000001 |0001H
= 000000000000 |取右1位=0
100000011000 |0818H
and 000000000010 |0002H
= 000000000000 |取右2位=0
100000011000 |0818H
and 000000000100 |0004H
= 000000000000 |取右3位=0
100000011000 |0818H
and 000000001000 |0008H
= 000000001000 |取右4位=1
以此类推
[解决办法]
Private Function GetBool(byval Num as Int64,byval index as interge) as string
dim tmp as int64 =pow(2,n)
if tmp =(num and tmp) then
return "1 "
else
return "0 "
end if
end sub
[解决办法]
在BitArray中对对应的元素赋True或False!