There is an ArrayList al, and I want to copy the first half of its elements into another ArrayList firstHalf. (If al
ArrayList al
ArrayList firstHalf
List firstHalf = al.subList(0, (int) al.size() / 2 + 1);
Is easier convert the al.size() / 2 to integer than doing "%2".
You add 1 to firstHalf to be bigger than the second half.