code: static int parseValidFlags(String flagChars, boolean hasUpperVariant) {
      int flags = hasUpperVariant ? FLAG_UPPER_CASE : 0;
      for (int i = 0; i < flagChars.length(); i++) {
        int flagIdx = indexOfFlagCharacter(flagChars.charAt(i));
        if (flagIdx < 0) {
          throw new IllegalArgumentException("invalid flags: " + flagChars);
        }
        flags |= 1 << flagIdx;
      }
      return flags;
    }
docs: Internal helper method for creating a bit-mask from a string of valid flag characters.