I'm not sure where I am going wrong, in IntelliJ, I keep getting an out of bounds exception, but I don't think I'm doing anything to or calling index 5(the 6th string in the index), so I'm not sure where this is wrong. Thanks for the help in advance!
package com.codegym.task.task07.task0711;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Remove and insert
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> arr = new ArrayList <String>();
int i =0;
String s1 = null;
int j = 0;
for (i = 0; i < 5; i++) {
arr.add(r.readLine());
}
{
for (j = 0; j < 13; j++) {
String s = arr.get(4);
arr.add(0, s);
arr.remove(4);
}
{
System.out.println(arr.get(i));
}
}
}
}