Created
March 8, 2018 19:33
-
-
Save valterh4ck3r/ef5840cfb1d1adf8b3cd336ba56f5c22 to your computer and use it in GitHub Desktop.
Converter Inteiro para Romano
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String parseNumeroRomano(Integer num) { | |
String M[] = {"", "M", "MM", "MMM"}; | |
String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; | |
String X[] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}; | |
String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; | |
return M[num / 1000] + C[(num % 1000) / 100] + X[(num % 100) / 10] + I[num % 10]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment