2014-02-27 25 views

回答

1
 String str = "abc"; 
     byte bytes[] = str.getBytes(); // Get the byte array 
     for (byte b : bytes) { 
      System.out.println("Byte is "+b); //Iterate and print 
     } 
     str = new String(bytes); // Create String from byte array 
     System.out.println("String is "+str); 
+0

我想他們有相同的內容,當使用getBytes()時,它的值不同 – CauBeRong

+0

@ user3150907哪個值不同? – Kick

+0

「str」和「bytes」。我希望變量「str」和「bytes」的值相同,所以我不使用getBytes()方法。 – CauBeRong

相關問題