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