标签:
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class StringUtil { public static String[] stringSort(String [] s) { List<String> list = new ArrayList<String>(s.length); for (int i = 0; i < s.length; i++) { list.add(s[i]); } Collections.sort(list); return list.toArray(s); } public static void main(String[] args) { String[] s = new String[]{"fuck", "suck", "apple", "jam"}; s = stringSort(s); for (int i = 0; i < s.length; i++) { System.out.println(s[i]); } } }
标签:
原文地址:http://www.cnblogs.com/sprinng/p/5045761.html