110,533
社区成员
发帖
与我相关
我的任务
分享
byte a =1; 对应的二进制值为—>00000001
byte b =64; 对应的二进制值为—>01000000
byte c = 128; 对应的二进制值为—>10000000
byte d = 16; 对应的二进制值为—>00010000
byte[] abc = new byte[4];
abc[0] = 1;
abc[1] = 64;
abc[2] = 128;
abc[3] = 16;
Int32 result = Convert.ToInt32((abc[0] << 24) + (abc[1] << 16) + (abc[2] << 8) + abc[3]);
int[] bytes = new int[] {1,64,128,16 };
int result=0;
for (int i = bytes.Length-1; i >-1 ; i--)
{
result += bytes[i] << ((bytes.Length-1-i) * 8);
}
Console.WriteLine("result:"+result);
UInt32 result = Convert.ToUInt32((val[0] << 24) + (val[1] << 16) + (val[2] << 8) + val[3]);