//转化十六进制的编码为字符串
public static String toStringHexl(String s){
byte[] bakkeyword = new byte[s.length()/2];
for(int i=0 ;i
try{
bakkeyword[i] = (byte)(0xff & Integer.parseInt(s.subString(i*2,i*2+2),16));
}catch (Exception e){
e.printStackTrace();
}
try{
s = new String(bakkeyword,"UTF-8");//UTF-16
}catch (Exception e1){
e1.printStackTrace();
}
}
return s;
}
//转化字符串为十六进制编码
public static String toHexString(String s){
String str = "";
for(int i=0;i
int ch = (int) s.charAt(i);
String s1 = Integer.toHexString(ch);
//若希望得到大写字母 '\U0030'
//String s1 = Integer.toHexString(ch).toUpperCase();
str = str +str1;
}
return str;
}
来源:CSDN
作者:30醒悟的码农
链接:https://blog.csdn.net/u010448750/article/details/103794551