code: static boolean checkFlagConsistency(int flags, boolean hasWidth) {
      // Check that we specify at most one of 'prefix plus' and 'prefix space'.
      if ((flags & (FLAG_PREFIX_PLUS_FOR_POSITIVE_VALUES | FLAG_PREFIX_SPACE_FOR_POSITIVE_VALUES))
          == (FLAG_PREFIX_PLUS_FOR_POSITIVE_VALUES | FLAG_PREFIX_SPACE_FOR_POSITIVE_VALUES)) {
        return false;
      }
      // Check that we specify at most one of 'left align' and 'leading zeros'.
      if ((flags & (FLAG_LEFT_ALIGN | FLAG_SHOW_LEADING_ZEROS))
          == (FLAG_LEFT_ALIGN | FLAG_SHOW_LEADING_ZEROS)) {
        return false;
      }
      // Check that if 'left align' or 'leading zeros' is specified, we also have a width value.
      if ((flags & (FLAG_LEFT_ALIGN | FLAG_SHOW_LEADING_ZEROS)) != 0 && !hasWidth) {
        return false;
      }
      return true;
    }
docs: Helper to check for legal combinations of flags.