Roman { public static String intToRoman(int num) { StringBuilder sb = new StringBuilder(); for (Object[] check : ROMAN_VALUE_BOUNDRY) { int v2 = Integer.valueOf(check[1].toString()); while (num >= v2) { int v1 = Integer.valueOf(check[0].toString()); String c1 = check[2].toString(); String c2 = check[3].toString(); if (num < v1) { sb.append(c2); } sb.append(c1); num -= v1; if (num < 0) { num += v1 - v2; } } } return sb.toString(); }  static String intToRoman(int num); static int romanToInt(String roman);  }
@Test(dataProvider = "intToRomanMap") public void testIntToRoman(int decimal, String roman) { assertEquals(Roman.intToRoman(decimal), roman); assertEquals(Roman.romanToInt(roman), decimal); }