code: public static byte[] decode(String s)
      {
          int len = s.length();
          if (len % 2 != 0)
          {
              return null;
          }
  
          byte[] bytes = new byte[len / 2];
          int pos = 0;
  
          for (int i = 0; i < len; i += 2)
          {
              byte hi = (byte) Character.digit(s.charAt(i), 16);
              byte lo = (byte) Character.digit(s.charAt(i + 1), 16);
              bytes[pos++] = (byte) (hi * 16 + lo);
          }
  
          return bytes;
      }
docs: If string is not even length, return null.