public static int charToInt(char c) {  
         int data = 0;  
   
         switch (c) {  
             case 'I':  
                 data = 1;  
                 break;  
             case 'V':  
                 data = 5;  
                 break;  
             case 'X':  
                 data = 10;  
                 break;  
             case 'L':  
                 data = 50;  
                 break;  
             case 'C':  
                 data = 100;  
                 break;  
             case 'D':  
                 data = 500;  
                 break;  
             case 'M':  
                 data = 1000;  
                 break;  
         }  
   
         return data;  
     }