public static byte[] string2Bytes(String buffer) {
String temp = buffer.replace(" ", "");
int len = temp.length();
byte[] b = new byte[len/2];
int j=0;
for(int i=0;i<len;i+=2) {
StringBuilder builder = new StringBuilder();
builder.insert(0, temp.charAt(i));
builder.insert(1, temp.charAt(i+1));
int t = Integer.valueOf(builder.toString(),16);
b[j] = (byte)t;
j++;
}
return b;
}