how to get the last 5 elements of array in java code example Example: java last element in array arrayName[arrayName.length() - 1];