@Test
public void test1() throws UnsupportedEncodingException {
// 三者等价
// byte [] a = {00010110, 01010010, 10111000};
// byte [] a = {0x16, 0x52, 0xB8};
// byte [] a = {22, 82, 184};
byte[] en = new byte[]{98,99};
System.out.println(new String(en));
// 使用gbk编码
byte[] cn = "你".getBytes("gbk");
System.out.println(Arrays.toString(cn));
// 不加charsetName是使用utf解码
System.out.println(new String(new byte[]{-60, -29}, "gbk"));
}
转载于:https://www.cnblogs.com/jzsg/p/11205257.html