在以下代码中怎么向有序的字符序列中插入字符 求解啊。急!!!!
在以下代码中怎么向有序的字符序列中插入字符
package cn.jbot;
import java.util.*;
public class cas {
/**
* @param args
*/
public static void main(String[] args) {
char num[] = { 'a', 'c', 'u', 'b', 'e', 'p', 'f', 'z', };
System.out.print("原字符序列:");
for (int i = 0; i < num.length; i++) {
System.out.print(num[i] + " ");
}
System.out.println("");
System.out.print("升序排列后:");
for (int i = 0; i < num.length; i++) {
Arrays.sort(num);
System.out.print(num[i] + " ");
}
System.out.println();
System.out.print("逆向排列后:");
for (int i = num.length - 1; i >= 0; i--) {
System.out.print(num[i] + " ");
}
}
}
------解决方案--------------------小喻啊,帮你搞定了!