Consider a following code snippet
byte[] b = new byte[]{ 0, 0, 0, -127 }; // possible Byte Array
// converted byte array to String using UTF-8
String s = String(b, StandardCharsets.UTF_8);
Now try again to convert the string into byte array
b = s.getBytes(StandardCharsets.UTF_8);
now when we compare it with original byte array, the value is not same on round trip
[0, 0, 0, -17, -65, -67]
Can anyone suggest how can we convert back the string to original byte array