String text;
      
byte[] b1 = text.getBytes("ISO8859-1");
text = new String(b1, "GB2312");

解决方案 »

  1.   

    或者
    String s = new String(byte[] b);
      

  2.   

    String str = new String(byte[] bt);
      

  3.   

    看String的两个构造函数
    String(byte[] bytes, int offset, int length, String charsetName) 
              Constructs a new String by decoding the specified subarray of bytes using the specified charset. 
    String(byte[] bytes, String charsetName) 
              Constructs a new String by decoding  
      

  4.   

    public String();
    public String(String str);
    public String(StringBuffer buffer);
    public String(char ch[]);
    public String(byte b[]);
      

  5.   

    public static String toString(byte[] a) {
            if (a == null)
                return "null";
            if (a.length == 0)
                return "[]";
     
            StringBuilder buf = new StringBuilder();
            buf.append('[');
            buf.append(a[0]);
     
            for (int i = 1; i < a.length; i++) {
                buf.append(", ");
                buf.append(a[i]);
            }
     
            buf.append("]");
            return buf.toString();
        }
      

  6.   

    StringBuilder   是JDK1.5的  类试  StringBuffer 功能