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();


    }
Utility class to allow for conversion from an integer to Roman numerals
or alpha-numeric symbols in line with Pages auto numbering formats.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-apple-module/src/main/java/org/apache/tika/parser/iwork/AutoPageNumberUtils.java