Guest User

Deromanizer

a guest
Oct 12th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1.     public int deromanize(String string){
  2.         int result=0;
  3.        
  4.         for(int i = string.length(); i > 0; i-- ){
  5.             for(RomanNumeral romanNumeral : RomanNumeral.values()){
  6.                 if(romanNumeral.name().equals(string.charAt(i-1)+"")){
  7.                     result += romanNumeral.getIntegerValue();
  8.                 }
  9.             }
  10.         }
  11.         return result;
  12.     }
  13.  
  14.  
Advertisement
Add Comment
Please, Sign In to add comment