I got an exception while parsing a string to byte
String Str =\"9B7D2C34A366BF890C730641E6CECF6F\";
String [] st=Str.split(\"(?<=\\\\G.{2})\");
byte[]by
That's because the default parse method expects a number in decimal format, to parse hexadecimal number, use this parse:
Byte.parseByte(st[i], 16);
Where 16 is the base for the parsing.
As for your comment, you are right. The maximum value of Byte is 0x7F. So you can parse it as int and perform binary AND operation with 0xff to get the LSB, which is your byte:
bytes[i] = Integer.parseInt(st[i], 16) & 0xFF;