标签:
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; }
标签:
原文地址:http://www.cnblogs.com/longzhaoyu/p/4571938.html