code: public static byte[] hexToByte(String hexStr) {
          int hexStrLength = hexStr.length();
          if (hexStrLength < 1)
              return null;
          byte[] result = new byte[hexStrLength / 2];
          for (int i = 0; i < hexStrLength / 2; i++) {
              int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
              int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16);
              result[i] = (byte) (high * 16 + low);
          }
          return result;
      }
docs: 将16进制转换为二进制