汉字在gbk编码中被转换成字节之后变成什么了,一个汉字变成了两个负数,是什么怎么变的?- package com.heima;
- public class 汉字的字符数量 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- byte[] zifu = "a我是afdd好的".getBytes();
- char[] zifu1 = "a我是afdd好的".toCharArray();
- for (int i = 0; i < zifu1.length; i++)
- System.out.print(zifu1[i] + ",");
- System.out.println();
- for (int i1 = 0; i1 < zifu.length; i1++)
- System.out.print(zifu1[i1] + ",");
- }
- }
复制代码 打印结果是
a,我,是,a,f,d,d,好,的,
97,-50,-46,-54,-57,97,102,100,100,-70,-61,-75,-60, |