第1个回答 2016-07-12
public class Demo {
public static void main(String[] args) throws UnsupportedEncodingException {
byte[] b1 = "你好".getBytes("utf-8");
byte[] b2 = new String(b1,0,b1.length,"UTF-8").getBytes("GBK");
System.out.println(new String(b1,0,b1.length));
System.out.println(new String(b2,0,b2.length));
}
}
//一个小例子,您可以看一下。本回答被提问者采纳