Here you can find the source of retrieveMinimumNotZeroDifference(List
private static int retrieveMinimumNotZeroDifference(List<Integer> percentClaimedHistory)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { 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; }//from ww w .j a v a 2 s . c o m } } return minimumDifference; } }