private Pair<Integer, Integer> findNonOverLappingCandidate(Pair<Integer, Integer> candidateIndexes, int maxIndex) {
    int range = candidateIndexes.getSecond() - candidateIndexes.getFirst() + 1;
    // ensure best and 2nd best have atleast 1 segment between them. If not, both of them put together will become the best candidate
    if (candidateIndexes.getSecond() + range + 1 > maxIndex) {
      return null;
    } else {
      int maxStartIndex = maxIndex - range + 1;
      int minStartIndex = candidateIndexes.getSecond() + 2;
      int newStartIndex = minStartIndex + TestUtils.RANDOM.nextInt(maxStartIndex - minStartIndex + 1);
      return new Pair<>(newStartIndex, newStartIndex + range - 1);
    }
  }
Find non overlapping candidates with the given candidate
@param candidateIndexes candidate indexes to compare against to find the non overlapping indexes
@param maxIndex maximum index of the non overlapping candidate to find
@return a {@link Pair} of Integers representing the indexes of the candidate that doesn't overlap with the
passed in {@code candidate}
ambry-store/src/test/java/com/github/ambry/store/StatsBasedCompactionPolicyTest.java