Here you can find the source of intToRoman(int value)
public static String intToRoman(int value)
//package com.java2s; public class Main { private final static String[] BASIC_ROMAN_NUMBERS = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv", "i" }; private final static int[] BASIC_VALUES = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 }; public static String intToRoman(int value) { if (value <= 0 && value >= 4000) { return null; }// www. ja v a 2s . co m String romanString = ""; int remainder = value; for (int i = 0; i < BASIC_VALUES.length; i++) { while (remainder >= BASIC_VALUES[i]) { romanString += BASIC_ROMAN_NUMBERS[i]; remainder -= BASIC_VALUES[i]; } } return romanString; } }