写了一个输入3个字符 输出所有排序的方法
public static void main(String[] args) {
String str = "abc";
char[] arr0 = str.toCharArray();
char[] arr1= new char[arr0.length*2];
System.arraycopy( arr0, 0, arr1, 0,arr0.length);
System.arraycopy( arr0, 0, arr1, arr0.length,arr0.length);
//char[] arr1={'a','b','c','a','b','c'};
for(int i=0;i<(arr1.length)/2;i++){
System.out.println(""+arr1[i]+arr1[i+1]+arr1[i+2]);
System.out.println(""+arr1[i]+arr1[i+2]+arr1[i+1]);
}
}
输出:
abc
acb
bca
bac
cab
cba