String s = "ABCD中国人";
// Byte 数组
byte[] bytes = s.getBytes("UTF-8");
System.out.println(bytes.length); // 目前编码为utf-8 为13字节 byte序列
System.out.println(Arrays.toString(bytes));
String str = new String(bytes,"UTF-8");
System.out.println(str); // 字符串 char序列
字符格式化
最新推荐文章于 2022-05-29 16:43:15 发布