To get the last value of an ArrayList use:
if (arrayList != null && !arrayList.isEmpty()) {
T item = arrayList.get(arrayList.size()-1);
}
or use the syntax below which is a part of the List interface (which ArrayList implements):
E e = list.get(list.size() - 1);
E is the component type. If the list is empty, get throws an IndexOutOfBoundsException. You can find the whole API documentation here.