level 5
笑嘻嘻的Acº
楼主
import java.util.Arrays;
public class Test3 {
public static void main(String[] args) {
String s2 = "我爱你中国";
byte[] b2 = s2.getBytes();
System.out.println(Arrays.toString(b2));
}
}
打印结果:
[-26, -120, -111, -25, -120, -79, -28, -67, -96, -28, -72, -83, -27, -101, -67]
一个中文不是应该2字节,那就应该只有10字节啊?为什么多了那么多。
我使用的win10,rapidclipse。有人解答吗?
2017年04月10日 15点04分
1
public class Test3 {
public static void main(String[] args) {
String s2 = "我爱你中国";
byte[] b2 = s2.getBytes();
System.out.println(Arrays.toString(b2));
}
}
打印结果:
[-26, -120, -111, -25, -120, -79, -28, -67, -96, -28, -72, -83, -27, -101, -67]
一个中文不是应该2字节,那就应该只有10字节啊?为什么多了那么多。
我使用的win10,rapidclipse。有人解答吗?