### Question:
DoublePercentileAggregatorFunction implements Function<List<Double>, Double> { final int computeRank(List<Double> data) { int maxRank = data.size() - 1; int rank = (int) Math.floor((percentile * maxRank) / MAX_PERCENTAGE); return rank; } DoublePercentileAggregatorFunction(double percentile);  DoublePercentileAggregatorFunction(double percentile, boolean useCopy); Double evaluate(List<Double> data); double getPercentile(); boolean isUseCopy(); @Override String toString();  }### Answer:
@Test public void testComputeRank() throws Exception { List<Double> data = new ArrayList<Double>(); data.add(0.0); data.add(1.0); data.add(2.0); data.add(3.0); data.add(4.0); DoublePercentileAggregatorFunction fct = new DoublePercentileAggregatorFunction(0.0); int rank = fct.computeRank(data); assertEquals(rank, 0); assertEquals(data.get(rank).doubleValue(), 0.0, DELTA); fct = new DoublePercentileAggregatorFunction(100.0); rank = fct.computeRank(data); assertEquals(rank, data.size() - 1); assertEquals(data.get(rank).doubleValue(), 4.0, DELTA); fct = new DoublePercentileAggregatorFunction(50.0); rank = fct.computeRank(data); assertEquals(rank, 2); assertEquals(data.get(rank).doubleValue(), 2.0, DELTA); fct = new DoublePercentileAggregatorFunction(40.0); rank = fct.computeRank(data); assertEquals(rank, 1); assertEquals(data.get(rank).doubleValue(), 1.0, DELTA); fct = new DoublePercentileAggregatorFunction(80.0); rank = fct.computeRank(data); assertEquals(rank, 3); assertEquals(data.get(rank).doubleValue(), 3.0, DELTA); fct = new DoublePercentileAggregatorFunction(70.0); rank = fct.computeRank(data); assertEquals(rank, 2); assertEquals(data.get(rank).doubleValue(), 2.0, DELTA); fct = new DoublePercentileAggregatorFunction(75.0); rank = fct.computeRank(data); assertEquals(rank, 3); assertEquals(data.get(rank).doubleValue(), 3.0, DELTA); }