Example usage for java.util DoubleSummaryStatistics accept

List of usage examples for java.util DoubleSummaryStatistics accept

Introduction

In this page you can find the example usage for java.util DoubleSummaryStatistics accept.

Prototype

@Override
public void accept(double value) 

Source Link

Document

Records another value into the summary information.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleSummaryStatistics stats = new DoubleSummaryStatistics();
    stats.accept(100.0);
    stats.accept(300.0);/*from   ww w.j av a  2s. c  o m*/
    stats.accept(230.0);
    stats.accept(532.0);
    stats.accept(422.0);

    long count = stats.getCount();
    double sum = stats.getSum();
    double min = stats.getMin();
    double avg = stats.getAverage();
    double max = stats.getMax();

    System.out.printf("count=%d, sum=%.2f,  min=%.2f,  average=%.2f, max=%.2f%n", count, sum, min, max, avg);
}