80,348
社区成员
发帖
与我相关
我的任务
分享
byte[] WriteBytes = new byte[17];
WriteBytes[0]=0x66;
WriteBytes[1]=0x00;
WriteBytes[2]=0x0B;
WriteBytes[3]=0x00;
WriteBytes[4]=0x10;
WriteBytes[5]=0x00;
WriteBytes[6]=0x10;
WriteBytes[7]=0x11;
WriteBytes[8]=0x22;
WriteBytes[9]=0x33;
WriteBytes[10]=0x44;
WriteBytes[11]=0x55;
WriteBytes[12]=0x66;
WriteBytes[13]=0x77;
WriteBytes[14]=(byte)0x88;
WriteBytes[15]=(byte)0x99;
WriteBytes[16]=(byte)0xFF;
Toast.makeText(Commviewer_ControlActivity.this, i+", "+String.valueOf((int)input[i]), Toast.LENGTH_SHORT).show();
public static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
16进制字节转16进制字符串 你转成字符串之后可以用 Integer.valueOf("16进制的字符串",16).toString(); 转10进制字符串 ,你那样直接转回有负数