byte[] bytes = new byte[20];bytes[1]=0x10;
bytes[1]=bytes[1] | 0x01;
编译出现如下错误:
请高手指教!!!谢谢!!
StringHexString.java:76: 可能损失精度
找到: int
需要: byte
bytes[i/2]=bytes[i/2] | 0x03;
^
StringHexString.java:87: 可能损失精度
找到: int
需要: byte
bytes[i/2]=bytes[i/2] | 0x04;
^
bytes[1]=bytes[1] | 0x01;
编译出现如下错误:
请高手指教!!!谢谢!!
StringHexString.java:76: 可能损失精度
找到: int
需要: byte
bytes[i/2]=bytes[i/2] | 0x03;
^
StringHexString.java:87: 可能损失精度
找到: int
需要: byte
bytes[i/2]=bytes[i/2] | 0x04;
^
如果你想要不出错,可以这样强制转换
bytes[1]=(byte)(bytes[1] | 0x01)
改成
bytes[i/2]=(byte)(bytes[i/2] | 0x03);