b=str1.getBytes();
str2=String.valueOf(b);

解决方案 »

  1.   

    java.lang Class String
    byte[] getBytes() 
              Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array. static String copyValueOf(char[] data) 
              Returns a String that is equivalent to the specified character array. 
      

  2.   

    b=str1.getBytes();
    str2=String.valueOf(b); or str2 = new String(b);