|
楼主的获取方式可能不太对?
要不要试试下面这个?
if (dataMap.get("binary") != null) {
byte[] binary = (byte[]) dataMap.get("binary");
Log.i("IOEDemo","Binary data:"+ bytesToHex(binary, 0, binary.length));
}
public static String bytesToHex(byte[] bytes, int offset, int count) {
char[] hexChars = new char[count * 3];
for (int j = 0; j < count; j++) {
int v = bytes[j + offset] & 0xFF;
hexChars[j * 3] = hexArray[v >>> 4];
hexChars[j * 3 + 1] = hexArray[v & 0x0F];
hexChars[j * 3 + 2] = ' ';
}
return new String(hexChars);
} |
|