last element index in array code example
Example 1: Javascript get last item in array
var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
Example 2: last 10 element of array
System.out.print(Primes1.get(Primes1.size() - 1) + " ");