@Test(expected = IllegalArgumentException.class) public void testFailingZero() { RomanNumbersUtils.toRoman(0); }
public static String toRoman(long toConvert) { if (toConvert <= 0) { throw new IllegalArgumentException(); } long n = toConvert; StringBuilder buf = new StringBuilder(); final Numeral[] values = Numeral.values(); for (int i = values.length - 1; i >= 0; i--) { while (n >= values[i].weight) { buf.append(values[i]); n -= values[i].weight; } } return buf.toString(); }
RomanNumbersUtils { public static String toRoman(long toConvert) { if (toConvert <= 0) { throw new IllegalArgumentException(); } long n = toConvert; StringBuilder buf = new StringBuilder(); final Numeral[] values = Numeral.values(); for (int i = values.length - 1; i >= 0; i--) { while (n >= values[i].weight) { buf.append(values[i]); n -= values[i].weight; } } return buf.toString(); } }
RomanNumbersUtils { public static String toRoman(long toConvert) { if (toConvert <= 0) { throw new IllegalArgumentException(); } long n = toConvert; StringBuilder buf = new StringBuilder(); final Numeral[] values = Numeral.values(); for (int i = values.length - 1; i >= 0; i--) { while (n >= values[i].weight) { buf.append(values[i]); n -= values[i].weight; } } return buf.toString(); } private  RomanNumbersUtils(); }
RomanNumbersUtils { public static String toRoman(long toConvert) { if (toConvert <= 0) { throw new IllegalArgumentException(); } long n = toConvert; StringBuilder buf = new StringBuilder(); final Numeral[] values = Numeral.values(); for (int i = values.length - 1; i >= 0; i--) { while (n >= values[i].weight) { buf.append(values[i]); n -= values[i].weight; } } return buf.toString(); } private  RomanNumbersUtils(); static String toRoman(long toConvert); }
RomanNumbersUtils { public static String toRoman(long toConvert) { if (toConvert <= 0) { throw new IllegalArgumentException(); } long n = toConvert; StringBuilder buf = new StringBuilder(); final Numeral[] values = Numeral.values(); for (int i = values.length - 1; i >= 0; i--) { while (n >= values[i].weight) { buf.append(values[i]); n -= values[i].weight; } } return buf.toString(); } private  RomanNumbersUtils(); static String toRoman(long toConvert);  }