How to implement Java Program to Calculate the Average of Integer Array?
Declare a method named calculateAverage that takes an integer array as a parameter and returns a double value representing the average.
Inside the calculateAverage method, declare two variables: sum to store the sum of all array elements, and average to store the calculated average.
Use a loop to iterate through each element of the array. Add each element to the sum variable.
After the loop, calculate the average by dividing the sum by the length of the array.
Return the average.
In the main method, create an integer array and initialize it with some values.
Call the calculateAverage method, passing the integer array as an argument, and store the result in a variable.
Print the calculated average.
