I have a byte array that's contains a string at the end of the array, and the beginning of the array is padded with zeroes. I'm using the following code to convert it to a string:
String myText = new String(byteArray, "UTF-8");
However, I'm getting a bunch of weird characters prepended to the string, due to the 0 padding. How do I get rid of it?