这是一个全排序的算法,大神帮我解释一下流程吧
public static void confusion(char[] str,int i){
		
		 if (i >= str.length)
             return;
         if (i == str.length - 1) {
             System.out.println(String.valueOf(str));
         } else {
             for (int j = i; j < str.length; j++) {
                 char temp = str[j];
                 str[j] = str[i];
                 str[i] = temp;
                 confusion(str, i + 1);
 
                 temp = str[j];
                 str[j] = str[i];
                 str[i] = temp;
             }
         }
		
	}
              
                  算法
                  java
                  全排序
              
------解决方案--------------------
第一次交换使用的是调用confusion方法的初始参数str,交换一次,再恢复一次,不就恢复到初始顺序了?