byte[] b=new byte[]{65,66,67,68};//字节数组
String s=new String(b,"ascii");//第二个参数指定编码方式
System.out.print(s);
new String(byteArray);
String(byte[] bytes)
Constructs a new String by decoding the specified array of bytes using the platform's default charset.
换成这个构造函数:
String(byte[] bytes, String charsetName)
Constructs a new String by decoding the specified array of bytes using the specified charset.
如果有中文的话,改成这个:new String(aa, "GB2312");告诉它转成GB2312格式的内容。
str=new String(aa,,"ISO-8859-1");