Here you can find the source of hexStr2Bytes(String src)
public static byte[] hexStr2Bytes(String src)
//package com.java2s; public class Main { public static byte[] hexStr2Bytes(String src) { int m = 0, n = 0; int l = src.length() / 2; byte[] ret = new byte[l]; for (int i = 0; i < l; i++) { m = i * 2 + 1;/*w w w .j a v a2 s .c om*/ n = m + 1; ret[i] = Byte.decode("0x" + src.substring(i * 2, m) + src.substring(m, n)); } return ret; } }