本帖最后由 fantacyleo 于 2014-7-31 13:35 编辑
- String s = "EF256345";
- byte[] bytes = new byte[s.length() / 2];
- for (int i = 0; i <= s.length() - 2; i+=2)
- bytes[i / 2] = (byte)Integer.parseInt(s.substring(i, i+2), 16);
- System.out.println(Arrays.toString(bytes));
复制代码 |