private static char[] getHex(String hex, int len) {
		char[] hexchar = new char[len];
		int i = 0;
		int j = 0;
		while (i < hex.length()) {
			int end = (i + 2 >= hex.length()) ? hex.length() : i + 2;
			if (hex.substring(i, end).equals("\\x")) {
				i = i + 2;
				hexchar[j++] = hex.charAt(i++);
				hexchar[j++] = hex.charAt(i++);
			} else {
				String sl = Integer.toHexString(hex.charAt(i++));
				if (sl.length() == 2) {
					hexchar[j++] = sl.charAt(0);
					hexchar[j++] = sl.charAt(1);
				} else
					System.err.println("invalid hex string: " + sl);
			}
		}
		return hexchar;
	}