Is there a native way to sort a String by its contents in java? E.g.
String s = \"edcba\" -> \"abcde\"
public static void main(String[] args) {
String str = "helloword";
char[] arr;
List l = new ArrayList();
for (int i = 0; i < str.length(); i++) {
arr = str.toCharArray();
l.add(arr[i]);
}
Collections.sort(l);
str = l.toString();
System.out.println(str);
str = str.replaceAll("\\[", "").replaceAll("\\]", "")
.replaceAll("[,]", "");
System.out.println(str);
}