hello ;sorry for my english
i make a code with a arraylist of char[];my goal is to make a mixture of 6 letters;I want to record each mixture in a arraylist;the code bellow is a part of my code wich have bein reduce for this forum;in this code the result is to do the first mixture (abcdef) ,but in the arraylist ,there is two time the second mixture (abcdfe);i don t know why;in my big complete code , i want to do all the mixture with the 6 letters ,and i obtain only the half result, but two time each result;in my for(i=4;i<=5;i++) , it forget the first result to put in my array list,and put 2 time the second;thanks for your explainations
package arraypourforum;
 
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
 
public class arraypourforum {
    static ArrayList<char[]> list = new ArrayList<char[]>();
    public static void main(String[] args) {
        int i;int f;
        char[] recu4= {'a','b','c','d','e','f'};
 
        char[] tourner5= new char[6];
 
        char[] envoi5= new char[6];
 
        tourner5[0]=recu4[0];
        tourner5[1]=recu4[1];
        tourner5[2]=recu4[2];
        tourner5[3]=recu4[3];
        for(i=4 ; i<= 5; i++){
            f=i+1;
 
 
            tourner5[4]=recu4[i];
 
            if((f)==6) {f=4;};         
            tourner5[5]=recu4[f];
 
            envoi5=tourner5;
 
            System.out.println(tourner5[0]+" "+tourner5[1]+" "+tourner5[2]+" "+tourner5[3]+" "+tourner5[4]+" "+tourner5[5]);
            // list.add(tourner5);
           graver(tourner5);
 
    }
        System.out.println("La taille de l'ArrayList: " + list.size());
        char reponse= 'O';
        char reponse2= 'n';
        char[]renvoi= new char[6];
 
        Scanner sc = new Scanner(System.in);
 
        while (!((reponse == 'N')||(reponse == 'n')))
        {System.out.println("ligne a lire");
            Scanner sc1 = new Scanner(System.in);
        int ligne;
        ligne = sc1.nextInt();
        renvoi=list.get(ligne);
        System.out.println(renvoi[0]+" "+renvoi[1]+" "+renvoi[2]+" "+renvoi[3]+" "+renvoi[4]+" "+renvoi[5]);
          System.out.println("Voulez-vous réessayer ? (O/N)");
 
          reponse = sc.nextLine().charAt(0);
        }
        System.out.println("Voulez-vous graver dans un fichier txt");
        reponse2 = sc.nextLine().charAt(0);
        if (reponse2 == 'o')
        {  {PrintWriter fich = null;
 
          try
            {fich = new PrintWriter(new FileWriter("C:\\Users\\fini.txt", true));
            int u;
            for (u=0;u<list.size();u++) {
                renvoi=list.get(u);
            fich.println(renvoi);}
            }
            catch (Exception e) {
 
                }
            finally
            {
                if ( fich != null )
                {
                    fich.close();
                }
            }
 
 
 
      }}
        System.out.println("j ai fini");}
    static void graver(char[]agraver) {
        list.add(agraver);
        return;
    }
}