public class StringSort {
	public static void main(String[] args){
		String[] arr = {"1101", "1100", "1001", "1110","1100","1101","0010","1000","0101","0011","1110","1011","0111","0110","1000","0100","1010",
				"aabb","aabc","abab","baba","acbc","baca","bcab","cacb","cbba","你","我","他","你好","我好","他好","她好"};
		
		Comparator cmp = Collator.getInstance(java.util.Locale.CHINA);
		Collections.sort(Arrays.asList(arr),Collections.reverseOrder(cmp));

		//想应用拼音排序只能用reverseOrder方法,不过如果需要正排可以对数组反向读取
		for(int i=0;i 
  

中文字符串是按拼音排序的

你可能感兴趣的:(字符串,排序,开发语言)