标签:http io os ar java sp on amp ef
//string 转 byte[]
String str = "Hello";
byte[] srtbyte = str.getBytes();
// byte[] 转 string
String res = new String(srtbyte);
System.out.println(res);
//当然还有可以设定编码方式 的
String str = "hello";
byte[] srtbyte = null;
try {
srtbyte = str.getBytes("UTF-8");
String res = new String(srtbyte,"UTF-8");
System.out.println(res);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
标签:http io os ar java sp on amp ef
原文地址:http://www.cnblogs.com/rxingyue/p/4042498.html