I have a situation where I need to process 5000 samples from a device in every 0.5 sec.
Lets say the window size is 100, then there would be 50 points resulting fro
Java 8 has added java.util.IntSummaryStatistics. There similar classes for Double and Long as well. Fairly straightforward to use:
Double
Long
IntSummaryStatistics stats = new IntSummaryStatistics(); stats.accept(1); stats.accept(3); stats.getAverage(); // Returns 2.0