你需要c或者java的代码的话.呵呵
delphi 几年没碰了,机器上都没有装
/**
* 将一个字节数据转换成 '1F' 这样的对应16进制字符串
* @param b byte 字节数据
* @return String
*/
public static String Byte2String(byte b) {
char[] str = new char[2];
str[0] = Byte2HexChar((byte) ((b >> 4) & 0x0F));
str[1] = Byte2HexChar((byte) (b & 0x0F));
return String.valueOf(str);
}
/**
* 将一个10进制的数字转换成16进制的字符
* @param value byte
* @return char 否则返回对应的16进制字符,转换失败返回0
*/
public static char Byte2HexChar(byte value) {
char result = 0;
switch (value) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9:
result = (char) (value + 0x30);
break;
case 10: case 11: case 12: case 13: case 14: case 15:
result = (char) (value + 0x37);
break;
}
return result;
}
public static void PrintDataHex(byte[] data) {
for (int i = 0; i < data.length; i++) {
System.out.print("0x" + Byte2String(data
) + " "
}
}
调用方法
//byte[] msgid = {(byte)0x8F, 0x39, 0x58, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};
String msgid ="0830142132000000100000";
MsgID mi = new MsgID(msgid);
PrintDataHex(mi.Encode());
System.out.println("/n"+mi);
结果:
0x8F 0x39 0x58 0x00 0x00 0x01 0x00 0x00
0830142132000000100000