@@ -0,0 +1,1481 @@
+package leetcode.roman_to_integer;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Apublic class Solution %7B%0A%09public int romanToInt(String s) %7B%0A%09%09Map%3CString, Integer%3E map = new HashMap%3CString, Integer%3E();%0A    %09String%5B%5D romans = new String%5B%5D%7B%0A    %09%09%22%22, %22I%22, %22II%22, %22III%22, %22IV%22, %22V%22, %22VI%22, %22VII%22, %22VIII%22, %22IX%22,%0A    %09%09%22X%22, %22XX%22, %22XXX%22, %22XL%22, %22L%22, %22LX%22, %22LXX%22, %22LXXX%22, %22XC%22,%0A    %09%09%22C%22, %22CC%22, %22CCC%22, %22CD%22, %22D%22, %22DC%22, %22DCC%22, %22DCCC%22, %22CM%22,%0A    %09%09%22M%22, %22MM%22, %22MMM%22,%0A    %09%7D;%0A    %09for(int i = 0; i %3C= 9; i++)%7B%0A    %09%09map.put(romans%5Bi%5D, i);%0A    %09%7D%0A    %09for(int i = 10; i %3C= 90; i += 10)%7B%0A    %09%09map.put(romans%5Bi / 10 + 9%5D, i);%0A    %09%7D%0A    %09for(int i = 100; i %3C= 900; i += 100)%7B%0A    %09%09map.put(romans%5Bi / 100 + 18%5D, i);%0A    %09%7D%0A    %09for(int i = 1000; i %3C= 3000; i += 1000)%7B%0A    %09%09map.put(romans%5Bi / 1000 + 27%5D, i);%0A    %09%7D%0A    %09int offset = 0;%0A    %09int ans = 0;%0A    %09while(offset %3C s.length())%7B%0A    %09%09for(int digits = Math.min(4, s.length() - offset); digits %3E= 1; digits--)%7B%0A    %09%09%09Integer val = map.get(s.substring(offset, offset + digits));%0A    %09%09%09if(val != null)%7B%0A    %09%09%09%09ans += val;%0A    %09%09%09%09offset += digits;%0A    %09%09%09%09break;%0A    %09%09%09%7D%0A    %09%09%7D%0A    %09%7D%0A    %09return ans;%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args)%7B%0A%09%09for(int i = 1; i %3C= 3999; i++)%7B%0A%09%09%09if(new Solution().romanToInt(new leetcode.integer_to_roman.Solution().intToRoman(i)) != i)%7B%0A%09%09%09%09System.err.println(%22failed at %22 + i);%0A%09%09%09%7Delse%7B%0A%09%09%09%09System.err.println(new leetcode.integer_to_roman.Solution().intToRoman(i) + %22 %22 + i);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add java solution for 13. Roman to Integer