public static int bytesToIntHigh(byte[] bytes)
{
int value = 0;
if (bytes != null && bytes.Length != 0)
{
for (int i = 0; i < bytes.Length; ++i)
{
value += (bytes[i] & 255) << 8 * (bytes.Length - i - 1);
}
}
return value;
}
例如:
字节数组:byte[] barr = new byte[2] { 0xA0,0xA2};
转换成:41122