Get the Average Value of an aAray Elements using JAVA

 The following Java code gives the average. 
  1. public class Avg {  
  2.     public static void main(String[] args) {  
  3.         //define an array  
  4.         int[] array = new int[] {  
  5.             3080659506601  
  6.         };  
  7.         //calculate sum of all array elements  
  8.         int sum = 0;  
  9.         for (int i = 0; i < array.length; i++)  
  10.         sum = sum + array[i];  
  11.         //calculate average value  
  12.         double average = sum / array.length;  
  13.         System.out.println("Average value of an array elements is : " + average);  
  14.     }  
  15. }  
Thank you, keep learning and sharing.