I am using a JNI API (that i can't change) that return a fixed size char array that represent a string.
I am converting it to String with String.valueOf(char [])
The problem is that i can receive an array like this {'a','b','c','\0','\0','\0'}
Using valueOf() keeps the trailing NULLs and a I get a wrong string.
Is there a simple way to convert such and array to string and removing NULLs?
String s = String.valueOf(bits).trim();
just trim the string it'll get rid of all *leading & *trailing white space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With