private static boolean containsAllBetween(Int2IntMap matches, int first, int last) {
    for (int i = first; i <= last; i++) {
      if (!matches.containsKey(i)) return false;
    }
    return true;
  }
private static boolean containsAllBetween(Int2IntMap matches, int first, int last)