public class RomanNumberFormatter extends Object
Constructor and Description |
---|
RomanNumberFormatter() |
Modifier and Type | Method and Description |
---|---|
static String |
intToRoman(int num)
整数转罗马数字
限制:[1,3999]的正整数 I 1 V 5 X 10 L 50 C 100 D 500 M 1000 |
static int |
romanToInt(String roman)
罗马数字转整数
|
public static String intToRoman(int num)
num
- [1,3999]的正整数public static int romanToInt(String roman)
roman
- 罗马字符IllegalArgumentException
- 如果传入非罗马字符串,抛出异常Copyright © 2025. All rights reserved.