code: static int earlier(int pos1, int pos2) {
          if (pos1 == Position.NOPOS)
              return pos2;
          if (pos2 == Position.NOPOS)
              return pos1;
          return (pos1 < pos2 ? pos1 : pos2);
      }
docs: Return the lesser of two positions, making allowance for either one
  being unset.