Here is my code:
byte[] bytes = ZipUtil.compress("string");
String str = bytes.toString();
//----------
System.out.println("bytes: " + bytes);
System.out.println("str: " + str);
System.out.println("str.getBytes(): " + str.getBytes());
As you see ZipUtil.compress()
returns byte[]
.
How can I convert str
content to byte[] ?
UPDATE:
output:
bytes: [B@6fd33eef
str: [B@6fd33eef
str.getBytes(): [B@15c8f644
As you see, if I use str.getBytes()
the content will be changed!