Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.estatisticas;
- import br.modelos.Solve;
- import java.util.ArrayList;
- /**
- * Criado por Lucas Sousa em 21/10/2015.
- */
- public class OverallMean {
- private ArrayList<Solve> solves;
- public OverallMean(ArrayList<Solve> solves) {
- this.solves = solves;
- }
- public long getOverallMeanValue() {
- if (solves != null) {
- if (solves.size() > 0) {
- ArrayList<Long> longValues = new ArrayList<>();
- for (Solve s : solves) {
- longValues.add(s.getTime());
- }
- long somatorio = 0;
- for (long x : longValues) {
- somatorio += x;
- }
- return (somatorio / longValues.size());
- }
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement