user43968 :
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?
mavriksc :
String s = String.valueOf(bits).trim();
just trim the string it'll get rid of all *leading & *trailing white space.