Purpose of the function
The purpose of the function in Listing 5 is to compute and return the average of the values stored in all of the elements in the array.
Note that even though the elements in the array are integer values of type long, the average value isn't necessarily an integer.
Therefore, the average is computed and returned as type double.