@Test public void testRomanUpper() { assertEquals("I", AutoPageNumberUtils.asRomanNumerals(1)); assertEquals("XXVI", AutoPageNumberUtils.asRomanNumerals(26)); assertEquals("XXVII", AutoPageNumberUtils.asRomanNumerals(27)); }
public static String asRomanNumerals(int i) { if ( i <= 0 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; if ( i > 3999 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; StringBuffer sbuff = new StringBuffer() ; i = i2r(sbuff, i, "M", 1000, "CM", 900, "D", 500, "CD", 400 ) ; i = i2r(sbuff, i, "C", 100, "XC", 90, "L", 50, "XL", 40 ) ; i = i2r(sbuff, i, "X", 10, "IX", 9, "V", 5, "IV", 4) ; while ( i >= 1 ) { sbuff.append("I") ; i -= 1 ; } return sbuff.toString() ; }
AutoPageNumberUtils { public static String asRomanNumerals(int i) { if ( i <= 0 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; if ( i > 3999 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; StringBuffer sbuff = new StringBuffer() ; i = i2r(sbuff, i, "M", 1000, "CM", 900, "D", 500, "CD", 400 ) ; i = i2r(sbuff, i, "C", 100, "XC", 90, "L", 50, "XL", 40 ) ; i = i2r(sbuff, i, "X", 10, "IX", 9, "V", 5, "IV", 4) ; while ( i >= 1 ) { sbuff.append("I") ; i -= 1 ; } return sbuff.toString() ; } }
AutoPageNumberUtils { public static String asRomanNumerals(int i) { if ( i <= 0 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; if ( i > 3999 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; StringBuffer sbuff = new StringBuffer() ; i = i2r(sbuff, i, "M", 1000, "CM", 900, "D", 500, "CD", 400 ) ; i = i2r(sbuff, i, "C", 100, "XC", 90, "L", 50, "XL", 40 ) ; i = i2r(sbuff, i, "X", 10, "IX", 9, "V", 5, "IV", 4) ; while ( i >= 1 ) { sbuff.append("I") ; i -= 1 ; } return sbuff.toString() ; }  }
AutoPageNumberUtils { public static String asRomanNumerals(int i) { if ( i <= 0 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; if ( i > 3999 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; StringBuffer sbuff = new StringBuffer() ; i = i2r(sbuff, i, "M", 1000, "CM", 900, "D", 500, "CD", 400 ) ; i = i2r(sbuff, i, "C", 100, "XC", 90, "L", 50, "XL", 40 ) ; i = i2r(sbuff, i, "X", 10, "IX", 9, "V", 5, "IV", 4) ; while ( i >= 1 ) { sbuff.append("I") ; i -= 1 ; } return sbuff.toString() ; }  static String asAlphaNumeric(int i); static String asAlphaNumericLower(int i); static String asRomanNumerals(int i); static String asRomanNumeralsLower(int i); }
AutoPageNumberUtils { public static String asRomanNumerals(int i) { if ( i <= 0 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; if ( i > 3999 ) throw new NumberFormatException("Roman numerals are 1-3999 ("+i+")") ; StringBuffer sbuff = new StringBuffer() ; i = i2r(sbuff, i, "M", 1000, "CM", 900, "D", 500, "CD", 400 ) ; i = i2r(sbuff, i, "C", 100, "XC", 90, "L", 50, "XL", 40 ) ; i = i2r(sbuff, i, "X", 10, "IX", 9, "V", 5, "IV", 4) ; while ( i >= 1 ) { sbuff.append("I") ; i -= 1 ; } return sbuff.toString() ; }  static String asAlphaNumeric(int i); static String asAlphaNumericLower(int i); static String asRomanNumerals(int i); static String asRomanNumeralsLower(int i);  }