public static byte[] hexTobytes(String hex) {
byte[] bytes = new byte[hex.length() / 2];
for (int i = 0; i < hex.length(); i = i + 2) {
String subStr = hex.substring(i, i + 2);
int intH = Integer.parseInt(subStr,16);
byte b = (byte) intH;
bytes[i / 2] = b;
}
return bytes;
}
字符串转字节
猜你喜欢
转载自blog.csdn.net/lemonmr/article/details/103060907
今日推荐
周排行