code: protected int popularNum() {
          if (greedy) {
              if (lower == 0) {
                  if (upper == 1) return 0;
                  else if (isRepeatInfinite(upper)) return 1;
              } else if (lower == 1) {
                  if (isRepeatInfinite(upper)) return 2;
              }
          } else {
              if (lower == 0) {
                  if (upper == 1) return 3;
                  else if (isRepeatInfinite(upper)) return 4;
              } else if (lower == 1) {
                  if (isRepeatInfinite(upper)) return 5;
              }
          }
          return -1;
      }
docs: /* ?:0, *:1, +:2, ??:3, *?:4, +?:5