我有一个单字节包含两个值。以下是文档:
The authority byte is split into two fields. The three least significant bits carry the user’s authority level (0-5). The five most significant bits carry an override reject threshold. If these bits are set to zero, the system reject threshold is used to determine whether a score for this user is considered an accept or reject. If they are not zero, then the value of these bits multiplied by ten will be the threshold score for this user.
Authority Byte:
7 6 5 4 3 ......... 2 1 0 Reject Threshold .. Authority
我没有在C#中处理二进制数的经验。
有人可以帮我转换Byte并获取如上述的值吗?
我尝试了以下代码:
BitArray BA = new BitArray(mybyte);
但是长度返回为29,而我期望的是8,即每个字节中的每一位。
-- 感谢大家的快速帮助。现在已经解决了!互联网太棒了。