Código Java promedio promedio complicado

 public double avg()
    {
        int sum = 0;
        for (int i = 0; i < size; i++)
        {
            sum += elementData[i];
        }
        double avg = (double) sum / size;
        return avg;
    }
Sid Potti