//客户端
public String changeToUnicode(String str){
StringBuffer strBuff = new StringBuffer();
for(int i=0;i<str.length();i++){
String temp = Integer.toHexString(str.charAt(i));
if(temp.length()!=4){
temp = "00"+temp;
}
if(temp.equals("00d")){
temp = "0"+temp;
}
if(temp.equals("00a")){
temp = "0"+temp;
}
strBuff.append(temp.substring(0, temp.length()-2));
strBuff.append(temp.substring(temp.length()-2, temp.length()));
}
String returnData = strBuff.toString();
return returnData;
}
//服务器端
public String changeToword(String str){
String retData = null;
String tempStr = new String(str);
String[] chStr = new String[str.length()/4];
for(int i=0;i<str.length();i++){
if(i%4==3){
chStr[i/4] = new String(tempStr.substring(0, 4));
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载
- 1
- 2
- 3
前往页