62,621
社区成员
发帖
与我相关
我的任务
分享//import java.util.*;
public class A {
public static void main(String []args) throws Exception{
String[] strs={"1","a","中文123"};
for(String str: strs){
System.out.println(str+":"+hexString(str));
}
}
public static String hexString(String arg){
byte[] bytes=arg.getBytes();
StringBuilder result=new StringBuilder();
for(byte b:bytes){
result.append(Integer.toHexString(b&0xff));
}
return result.toString();
}
}