Leaving the actual parsing for you to find out, this is what I described in comment:
String[] sNums = key.split(","); // Mind that the elements will still contain whitespace!
byte[] bNums = new byte[sNums.length];
for( int i = 0; i < bNums.length; i++ )
{
if( sNums[i].trim().startsWith("0x") )
{
bNums[i] = [insert hex parsing here]
}
else
{
bNums[i] = [insert decimal parsing here]
}
}
Not very efficient nor elegant, but will probably work if parsing is done right.
Spoiler : Boris in fact already spoiled the Hex-Parsing (point your mouse on yellow field vv )
Integer.valueOf(s,16).byteValue()
Going from there, you surely can figure out decimal parsing.