@@ -0,0 +1,1207 @@
+package leetcode.repeated_dna_sequences;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Solution %7B%0A%09public String toATCG(int n)%7B%0A%09%09StringBuilder sb = new StringBuilder();%0A%09%09String ATCG = %22ATCG%22;%0A%09%09for(int i = 9; i %3E= 0; i--)%7B%0A%09%09%09int v = (n %3E%3E (2 * i)) & 3;%0A%09%09%09sb.append(ATCG.charAt(v));%0A%09%09%7D%0A%09%09return sb.toString();%0A%09%7D%0A    public List%3CString%3E findRepeatedDnaSequences(String s) %7B%0A        List%3CString%3E ret = new ArrayList%3CString%3E();%0A        byte%5B%5D appeared = new byte%5B0x100000%5D;%0A        s = s.replace(%22A%22, %220%22).replace(%22T%22, %221%22).replace(%22C%22, %222%22).replace(%22G%22, %223%22);%0A        if(s.length() %3C 10)%7B%0A        %09return ret;%0A        %7D%0A        int n = 0;%0A        for(int i = 0; i %3C 9; i++)%7B%0A        %09n *= 4;%0A        %09n += s.charAt(i) - '0';%0A        %7D%0A        for(int i = 9; i %3C s.length(); i++)%7B%0A        %09n *= 4;%0A        %09n += s.charAt(i) - '0';%0A        %09n &= 0xFFFFF;%0A        %09if(appeared%5Bn%5D %3C 2)%7B%0A        %09%09if(appeared%5Bn%5D == 1)%7B%0A        %09%09%09ret.add(toATCG(n));%0A        %09%09%7D%0A        %09%09appeared%5Bn%5D++;%0A        %09%7D%0A        %7D%0A        return ret;%0A    %7D%0A    public static void main(String%5B%5D args)%7B%0A    %09System.err.println(new Solution().findRepeatedDnaSequences(%22AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT%22));%0A    %7D%0A%7D%0A

Add java solution for 187. Repeated DNA Sequences