将byte []转换为string到byte []

时间:2017-02-17 00:43:22

标签: java

让我们假设我有一个byte [],我想将它转换为String然后再转换为byte []。

byte[] b = {-23, -38, 62, 22, -25, -23, 46, 106, -38, 13, -2, -46, 6, -110, 25, -82};   
System.out.println(Arrays.toString(new String(b).getBytes()));

我收到其他字节[]:

  

[ - 17,-65,-67,-17,-65,-67,62,22,-17,-65,-67,-17,-65,-67,46,106,-17 ,-65,-67,13,-17,-65,-67,-17,-65,-67,6,-17,-65,-67,25,-17,-65,-67] < / p>

为什么会这样?我可以得到一个初始字节[]吗?

0 个答案:

没有答案