public void add(float number) {
    sum += number;
    n++;
    if (n == Integer.MAX_VALUE) {
      sum /= 2f;
      n /= 2;
    }
  }
Class to calculate the average in a stream of numbers on a continuous basis.
lottie/src/main/java/com/airbnb/lottie/utils/MeanCalculator.java