Java | Fast solution
\nclass Solution {\n    private static HashSet<Integer> primes = new HashSet<>();\n    private static List<Integer> list = new ArrayList<>();\n    static {\n   
```\nclass Solution {\n    private static HashSet<Integer> primes = new HashSet<>();\n    private static List<Integer> list = new ArrayList<>();\n    static {\n        int m = 1_000_001;\n        boolean[] visited = new boolean[m];\n        for(int i=2;i<m;i++) {\n            if(!visited[i]){\n                primes.add(i);\n                list.add(i);\n                for(int j=i;j<m;j+=i) visited[j] = true;\n            }\n        }\n    }\n    public List<List<Integer>> findPrimePairs(int n) {\n        List<List<Integer>> answer = new ArrayList<>();\n        for(int a: list){\n            int other = n-a;\n            if(other<n/2 || a>n/2) break;\n            if(primes.contains(other)) answer.add(List.of(a,other));\n        }\n        return answer;\n    }\n}\n```
['Java']