when I try to use it, it always returns something like [C@bebf1eb
Yes the toString()
method for arrays is not overidden so you get the default implementation.
Use the String constructor that takes a char array instead.
return new String(result);
If you want to avoid to recopy the content of the array when creating your String, you could use a
StringBuilder
and append the char to it when it's needed.
At the end, simply return myStringBuilder.toString();