按字母排序

static void so(){
System.out.print("Please input a piece of string: ");
String input = new Scanner(System.in).next().trim();
char[] ary = input.toCharArray();
Arrays.sort(ary);

StringBuilder sb = new StringBuilder();
sb.append(ary);

System.out.println(sb.reverse().toString());
}

你可能感兴趣的:(OPhone)