Package Algorithm;public class Sortall {public static void main (string[] args) {char buf[] = {' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 '};p erm (bu F,0,BUF.LENGTH-1);} private static void Perm (char[] buf, int start, int end) {if (start==end) {///when only one letter in an array is required to be fully arranged, as long as it is output as an int i=0;i& lt;=end;i++) {System.out.print (" " +buf[i]);} System.out.println ("");} else{//multiple letters all arranged for (int i=start;i<=end;i++) {Char temp = buf[start];//Interchange array first element with subsequent elements buf[start]=buf[i];buf[i]=temp ;p erm (buf,start+1,end);//The subsequent element recursively arranges the entire array of temp = buf[start];//to restore the swapped arrays Buf[start]=buf[i];buf[i]=temp;}}}Interested can refer to here: http://bbs.csdn.net/topics/320011373
Java Full Array