Java中byte[]和String的转换问题
2018-10-02 本文已影响0人
Rimson
String转byte[]:
String str="hello";
byte[] strByte=str.getBytes();
byte[]转String:
String test=strByte.toString();
String res = new String(srtByte);
test不是"hello"
res是"hello"
String转byte[]:
String str="hello";
byte[] strByte=str.getBytes();
byte[]转String:
String test=strByte.toString();
String res = new String(srtByte);
test不是"hello"
res是"hello"