Dapatkan rata -rata array di java

double[] array = {19, 12, 16, 200, 13}; //Array
double total = 0; //Initialising total variable
double average = 0; //Initialising average variable

for(int i=0; i<array.length; i++){ // Looping through to retrieve total value
  total += array[i];
}

average = total / array.length; // Dividing the total by the length of the array OR number of numbers to get the average.

System.out.println("The average is: " + average);
AJ Byrne