arrayName[arrayName.length() - 1];
ArrayList<Integer> list = new ArrayList<Integer>(5);
int last = list.get(list.size() - 1);
int e = list.get(list.size() - 1);
List<Post> myLastPosts = posts.subList(posts.size()-40, posts.size());
List<E> tail = l.subList(Math.max(l.size() - 3, 0), l.size());
// Array of doubles
double[] array_doubles = {2.5, 6.2, 8.2, 4846.354, 9.6};
// First position
double firstNum = array_doubles[0]; // 2.5
// Last position
double lastNum = array_doubles[array_doubles.length - 1]; // 9.6