Here you can find the source of getScoreSeriesByMinMaxAndDiff(List
public static double getScoreSeriesByMinMaxAndDiff(List<Integer> percentClaimedHistory)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static double getScoreSeriesByMinMaxAndDiff(List<Integer> percentClaimedHistory) { Integer first = percentClaimedHistory.get(0); Integer current = percentClaimedHistory.get(percentClaimedHistory.size() - 1); int diff = current.intValue() - first.intValue(); double score = diff * Math.pow(retrieveMinimumNotZeroDifference(percentClaimedHistory), -1); return score; }//ww w . j ava 2 s . co m private static int retrieveMinimumNotZeroDifference(List<Integer> percentClaimedHistory) { // Let's assume the higher difference int minimumDifference = 100; for (int i = 0; i < percentClaimedHistory.size(); i++) { Integer outerPercent = percentClaimedHistory.get(i); for (int j = 0; j < percentClaimedHistory.size(); j++) { Integer innerPercent = percentClaimedHistory.get(j); int currentDifference = Math.abs(outerPercent - innerPercent); if (currentDifference != 0 && currentDifference < minimumDifference) { minimumDifference = currentDifference; } } } return minimumDifference; } }