真心觉得这个递归还是很麻烦的。
public static void doit(String a,String b,int k){
if(a.length()==k){
System.out.println(a); //当选出的字符串与原字符串长度相同时打印
}else{
for(int i = 0; i< b.length(); i++){ //C31*C21*C11排列;
String tempa = new String(a);
String tempb = new String(b);
doit(tempa+tempb.charAt(i),new StringBuilder(tempb).deleteCharAt(i).toString(),a.length()+b.length()); //递归调用
}
}
}
public static void main(String[] args) {
String str = "abc";
doit("",str,str.length());
}