I would recommend converting the Character[] to a char[] using a simple loop and then passing it into new String();
Character[] characters = new Character[128];
char[] chars = new char[characters.length];
int length = characters.length;
for(int i=0; i<length; i++) {
chars[i] = characters[i].charValue();
}
String string = new String(chars);
Another alternative would be to create a StringBuilder and loop through and add each character individually.
Character[] characters = new Character[128];
StringBuilder sb = new StringBuilder(characters.length);
for(Character c : characters) {
sb.append(c);
}
String string = sb.toString();
I have a feeling the first approach might be more efficient, but I'm not sure.
Character[]The best thing to do is to refactor your code so you don't have one in the first place. Use achar[]or aStringBuilderinstead.