package task1_7; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class reverse { public static void main(String[] args) { List list = new ArrayList<>(Arrays.asList(1,2,3,4,5)); System.out.println("Original List: " + list); int start = 0; int end = list.size() - 1; while (start < end) { Integer temp = list.get(start); list.set(start, list.get(end)); list.set(end, temp); start++; end--; } System.out.println("Reversed List: " + list); } }