我有一个java程序,其中读取一个标识号。喜欢" 1234567"现在我想将ascii值转换为十六进制值,并将其放在十六进制字节数组中,如下所示:
byte[] bytes = {0x02, 0x0b, 0x39, 0x36, 0x31, 0x31, 0x32, 0x36, 0x31, 0x39, 0x39, 0x34, 0x37, 0x32, 0x03};
问题是..我不知道我怎么能这样做..你有解决方案或提示吗?谢谢!
String foo = receivedData.substring(10,21);
BigInteger data = new BigInteger(foo);