code: public static CodeRangeBuffer andCodeRange1(CodeRangeBuffer pbuf, ScanEnvironment env, int from1, int to1, int[]data, int n) {
          for (int i=0; i<n; i++) {
              int from2 = data[i * 2 + 1];
              int to2 = data[i * 2 + 2];
              if (from2 < from1) {
                  if (to2 < from1) {
                      continue;
                  } else {
                      from1 = to2 + 1;
                  }
              } else if (from2 <= to1) {
                  if (to2 < to1) {
                      if (from1 <= from2 - 1) {
                          pbuf = addCodeRangeToBuff(pbuf, env, from1, from2 - 1);
                      }
                      from1 = to2 + 1;
                  } else {
                      to1 = from2 - 1;
                  }
              } else {
                  from1 = from2;
              }
              if (from1 > to1) break;
          }
  
          if (from1 <= to1) {
              pbuf = addCodeRangeToBuff(pbuf, env, from1, to1);
          }
  
          return pbuf;
      }
docs: and_code_range1