List of utility methods to do Integer to Roman
String | IntegerToRoman(int n) Integer To Roman String roman = ""; int repeat; int magnitude[] = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 }; String symbol[] = { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" }; repeat = n / 1; for (int x = 0; n > 0; x++) { repeat = n / magnitude[x]; for (int i = 1; i <= repeat; i++) { ... |
String | integerToRoman(int n) Convert integer to a Roman numeral. StringBuffer result = new StringBuffer(); int i = 0; while (n > 0) { while (n >= integerValues[i]) { result.append(romanNumerals[i]); n -= integerValues[i]; i++; ... |