Class RomanNumeralConverter
java.lang.Object
johnsmith.enchantmentcore.api.util.RomanNumeralConverter
Utility class for converting between standard integers and classical Roman numeral strings
in the range $[1, 3999]$.
-
Method Summary
-
Method Details
-
toRoman
Converts an integer into its classical Roman numeral representation.Supports integers in the closed interval $[1, 3999]$. Values outside this range are returned as standard base-10 Arabic numeral strings via
String.valueOf(int).- Parameters:
number- The integer to convert.- Returns:
- The Roman numeral string, or the Arabic numeral string if
number < 1ornumber > 3999.
-
parse
Parses a Roman numeral string into its integer value.Supports numerals in the classical range from
"I"($1$) to"MMMCMXCIX"($3999$).- Parameters:
romanNumeral- The Roman numeral string to parse (case-insensitive).- Returns:
- The parsed integer value in $[1, 3999]$, or
-1if the value is null, blank, or malformed.
-