class HexUtils {

    public static byte[] hexToBytes(String hexString, String delimiter) {
        // first convert to upper case to ease the rest
        String ucHexString = hexString.toUpperCase();

        final String[] splitted = ucHexString.split(delimiter);

        final byte[] bytes = new byte[splitted.length];
        int pos = 0;
        for (final String part : splitted) {
            final byte[] in = part.getBytes(StandardCharsets.UTF_8);
            if (in.length != 2) {
                throw new IllegalArgumentException("hexString needs to have an even length: " + hexString);
            }
            bytes[pos++] = (byte) (unhex(in[0]) << 4 | unhex(in[1]));
        }
        return bytes;
    }

    private  HexUtils();

}