private static boolean rangesIntersect(int start0, int end0, boolean start0Inclusive, boolean end0Inclusive,
                                         int start1, int end1, boolean start1Inclusive, boolean end1Inclusive) {
    if (start0 > start1 || start0 == start1 && !start0Inclusive) {
      if (end1 == start0) return start0Inclusive && end1Inclusive;
      return end1 > start0;
    }
    if (end0 == start1) return start1Inclusive && end0Inclusive;
    return end0 > start1;
  }
private static boolean rangesIntersect(int start0, int end0, boolean start0Inclusive, boolean end0Inclusive,
                                         int start1, int end1, boolean start1Inclusive, boolean end1Inclusive)