80,350
社区成员
发帖
与我相关
我的任务
分享
/**
* strings to Hexadecimal array,seperate string by space
* @param strHexValue Hexadecimal string
* @return byte array
*/
public static byte[] stringToByteArray(String strHexValue) {
String[] strAryHex = strHexValue.split(" ");
byte[] btAryHex = new byte[strAryHex.length];
try {
int nIndex = 0;
for (String strTemp : strAryHex) {
btAryHex[nIndex] = (byte) Integer.parseInt(strTemp, 16);
nIndex++;
}
} catch (NumberFormatException e) {
}
return btAryHex;
}