日期:2014-05-20 浏览次数:20684 次
public static void main(String[] args) {
String ss = "23 12 26";
sortSS(ss);
}
private static void sortSS(String ss) {
String[] st = ss.split(" ");
StringBuffer sb = new StringBuffer();
Arrays.sort(st);
for (String s : st) {
sb.append(s + " ");
}
System.out.println(sb);
}
public static void main(String[] args) throws Exception {
String str = "23 12 26";
String strArray[] = str.split(" ");
Arrays.sort(strArray);
String endStr = "";
for (String string : strArray) {
endStr = endStr + String.valueOf(string) + " ";
}
System.out.println(endStr);
}
import java.util.*;
public class SortTest
{
public static void main(String[] args)
{
ArrayList<String> arryList = new ArrayList<>();
arryList.add("23");
arryList.add("12");
arryList.add("26");
Collections.sort(arryList);
System.out.println(arryList);
System.out.println("Hello World!");
}
}