package cn.itcast1;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
public class Utf_8 {
public static void main(String[] args) throws UnsupportedEncodingException {
String s = "我爱你";
byte[] bytes = s.getBytes("UTF-8");
System.out.println(Arrays.toString(bytes));
String result = new String(bytes, "UTF-8");
System.out.println(result);
}
}
//[-26, -120, -111, -25, -120, -79, -28, -67, -96]
|
|