what is the jvm byte[] instance charset

122 Views Asked by At

I run application using idea and dump heap useing jvisualvm. a byte[] instance looks like 5, 0, -110, 104, 6, 9, 1, 2, -112, -128, -127, 0, 9, -110, 100, 2, 5, 84, 114, 101, 101, 115, 10, 2, 3, 4, 1, 3, 97, 112, 105, 10, 2, 5, 6, 1, 7, 114, 101, 102, 108, 101, 99, 116, 10, 1, 7, 1, 5, 115, 99, 97, 108, 97, 3, 0, 19, 2, 0, 10, 16, 2, 11, 12, 13, 1... too many byte[] enter image description here I want to see byte message , but the result turns Garbled, what should i do?

System.out.println(Charset.defaultCharset());  // UTF-8
byte[] bytes = {5, 0, -110, 104, 6, 9, 1, 2, -112...};
System.out.println(new String(bytes, "UTF-8"));
0

There are 0 best solutions below