java中字符串 utf8 转为 gbk

String plain = "你好";
byte[] bytes = plain.getBytes("utf-8");

byte[] bytes2 = new String(bytes, "utf-8").getBytes("gbk");

plain=new String(bytes2, "gbk");

你可能感兴趣的:(java中字符串 utf8 转为 gbk)