public static String toHex(String str){
        try {
            byte[] bytes = str.getBytes("GBK");
            StringBuilder sb = new StringBuilder(bytes.length * 2);
            //转换hex编码
            for (byte b : bytes) {
                sb.append(Integer.toHexString(b + 0x800).substring(1));
            }
            return sb.toString();
        } catch (UnsupportedEncodingException e) {
            log.error(e);
        }
        return null;
    }

 

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2021-11-18
  • 2021-08-11
  • 2021-12-20
  • 2021-11-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-12-07
  • 2022-12-23
  • 2021-08-27
  • 2021-04-08
相关资源
相似解决方案