我可以将字符串转换为UTF-8编码的数组,但我无法像原始字符串那样将其转换回字符串。
public static void main(String[] args) {
Scanner h = new Scanner(System.in);
System.out.println("INPUT : ");
String stringToConvert = h.nextLine();
byte[] theByteArray = stringToConvert.getBytes();
System.out.println(theByteArray);
theByteArray.toString();
String s = new String(theByteArray);
System.out.println(""+s);
}
如何将theByteArray
以字符串形式打印出来?