package algorithms.arrayrotation;

import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class SolutionWithJavaApi {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int listSize = scanner.nextInt();
    int rotations = scanner.nextInt();
    scanner.nextLine();
    List<String> integers = IntStream.range(0, listSize).mapToObj(i -> String.valueOf(scanner.nextInt())).collect(Collectors.toList());
    Collections.rotate(integers, listSize - rotations);
    System.out.println(String.join(" ", integers));
  }
}

@@ -304,16 +304,17 @@
 em.in);%0A
+%0A
     int 
@@ -378,24 +378,25 @@
 .nextInt();%0A
+%0A
     scanner.
@@ -403,24 +403,25 @@
 nextLine();%0A
+%0A
     List%3CStr
@@ -464,16 +464,23 @@
 istSize)
+%0A      
 .mapToOb
@@ -520,16 +520,23 @@
 tInt()))
+%0A      
 .collect
@@ -558,16 +558,17 @@
 ist());%0A
+%0A
     Coll

solve array rotation with Java's API