private static byte[] toId(String id) throws InvalidMessageIdException {
        byte ret[] = new byte[MESSAGE_ID_LEN];

        if (id == null) {
            return null;
        }
        //长度校验
        if (id.length() != MESSAGE_ID_LEN * 2) {
            throw new InvalidMessageIdException("message ID[" + id + "]的长度必须为" + MESSAGE_ID_LEN * 2);
        }
        //进行转化
        try {
            for (int i = 1; i <= MESSAGE_ID_LEN; i++) {
                ret[MESSAGE_ID_LEN - i] = (byte) Integer.parseInt(id.substring(2 * i - 2, 2 * i),
                    16);
            }
        } catch (Exception e) {
            throw new InvalidMessageIdException("message ID[" + id + "]不合法", e);
        }
        return ret;
    }