【发布时间】:2018-11-10 15:07:17
【问题描述】:
我想将我的byte[] 转换为String,然后将String 转换为byte[]。
所以,
byte[] b = myFunction();
String bstring = b.toString();
/* Here the methode to convert the bstring to byte[], and call it ser */
String deser = new String(ser);
bstring 给了我[B@74e752bb。
然后将String 转换为byte[]。我没有按这个顺序使用它,但这是一个例子。
我需要如何在 Java 中做到这一点?
【问题讨论】:
-
为什么不
new String(b)而bstring.getBytes()呢? -
@nullpointer 因为我在另一个类中使用 b 然后是 ser 的东西...