public static int parseOptionalBoundedInt(String intStr, int defaultValue, int minValue,
			int maxValue) throws NumberFormatException {
		if (intStr != null) {
			long tmp = parseLong(intStr);
			if (tmp < minValue || tmp > maxValue) {
				throw new NumberFormatException(
					"Integer value " + tmp + " out of range: [" + minValue + ".." + maxValue + "]");
			}
			return (int) tmp;
		}
		return defaultValue;
	}
Parses the optional specified string as a decimal number, returning its
integer value, or defaultValue if the string is null.

@param intStr string with integer digits, or null.
@param defaultValue value to return if intStr is null.
@param minValue minimum value allowed (inclusive).
@param maxValue maximum value allowed (inclusive).
@return integer value of the intStr.
@throws NumberFormatException if intStr could not be parsed or is out of
            range.
Ghidra/Framework/Generic/src/main/java/ghidra/util/xml/XmlUtilities.java