i don't inderstand the return of the console, il describe my logic in commentary
package fr.codegym.task.task07.task0720;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Mélange en temps opportun
*/
public class Solution {
public static void main(String[] args) throws IOException {
//Lecture --read system
BufferedReader saisie = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(saisie.readLine());
int m = Integer.parseInt(saisie.readLine());
// initalisation liste --inital list
ArrayList<String> liste = new ArrayList<String>();
//remplissage de la liste --add element in list
for(int i = 0; i<n; i++) {
liste.add(saisie.readLine());
}
// récupération des 3 premiers éléments dans des variables indépendante --save 3 first elements before remove
String a = liste.get(0);
String b = liste.get(1);
String c = liste.get(2);
// suppression des 3 premieres variables -- delete 3 first element
for (int i = 0; i < m; i++) {
liste.add(liste.remove(0));
}
//ajout des trois permiers eléments a la fin de la liste ---add element at the end of the list
liste.add(a);
liste.add(b);
liste.add(c);
//affichage de la liste --print list
for (String s : liste) {
System.out.println(s);
}
}
}