public class Main {
public static void main(String[] args){
int[] array=new int[]{1,2,3,4};
int total=0;
while(null!=array){
System.out.print("第"+(++total)+"个排列为:");
for(int i=0;i<array.length;i++){
System.out.print(array[i]);
}
System.out.println();
array=sequence(array);
}
}
public static int[] sequence(int[] array){
int i=-1;
int j=-1;
int index=array.length-1;
for(;index>=1;index--){
if(array[index-1]<array[index]){
i=index;
public static int[] sequence(int[] array){
int i=-1;
int j=-1;
int index=array.length-1;
for(;index>=1;index--){
if(array[index-1]<array[index]){
i=index;