int code = 500;
int high = ((code & 0xff00) >> 8);
int low = code & 0x00ff;
System.out.print("high-low: " + high + " " + low);
打印结果:high-low: 1 244 16进制: 0x01 ,0xF4
我要发送的数据就是 byte [] = {0x01,0xF4};
现在接收到 byte[] = {0x12,0xFA};分别是code的高四位和低四位,
我要怎样才能计算出code的值?
求大神给代码,谢谢!