DuplicateScoringSupport { public static double scoreIntervalOverlap(int[] sourceInterval, int[] targetInterval) { int from = Math.max(sourceInterval[0], targetInterval[0]); int to = Math.min(sourceInterval[1], targetInterval[1]); double overlap = Math.max(to - from, 0); return (overlap / (sourceInterval[1] - sourceInterval[0]) + overlap / (targetInterval[1] - targetInterval[0])) / 2; }  static double scoreElementOverlap(Collection<T> a, Collection<T> b); static double scoreElementOverlap(Collection<T> a,
      Collection<T> b, Set<T> common); static double scoreElementOverlap(SortedSet<T> a, SortedSet<T> b); static double scoreIntervalOverlap(int[] sourceInterval,
      int[] targetInterval);  }
@Test public void testScoreIntervalOverlap() { assertEquals(1.0, DuplicateScoringSupport.scoreIntervalOverlap(new int[] { 0, 10}, new int[] {0, 10}), 0.0); assertEquals(0.75, DuplicateScoringSupport.scoreIntervalOverlap(new int[] { 0, 5}, new int[] {0, 10}), 0.0); assertEquals(0.333, DuplicateScoringSupport.scoreIntervalOverlap(new int[] { 0, 6}, new int[] {4, 10}), 0.001); assertEquals(0.583, DuplicateScoringSupport.scoreIntervalOverlap(new int[] { 0, 8}, new int[] {4, 10}), 0.001); assertEquals(0.0, DuplicateScoringSupport.scoreIntervalOverlap(new int[] { 0, 5}, new int[] {5, 10}), 0.0); }