Java 🔥✅ || Easy to understand || using sieveOfEratosthenes
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public List<List<Integer>> findPrimePairs(int n) {\n            List<List<Integer>> ans=new ArrayList<>();\n            boolean[]primes=sieveOfEratosthenes(n);\n            int[]vis=new int[n+1];\n        for(int i=1;i<=n;i++)\n        {\n                if((n-i)<=n && (n-i)>0 && primes[i] && primes[n-i] && vis[i]!=1 && vis[n-i]!=1)\n                {\n                        ans.add(new ArrayList<>(Arrays.asList(i,n-i)));\n                        vis[i]=1;\n                        vis[n-i]=1;\n                }\n        }\n            Collections.sort(ans, (a, b) -> Integer.compare(a.get(0),b.get(0)));\n            return ans;\n            \n        }\n\n    public static boolean[] sieveOfEratosthenes(int n) \n     {\n         boolean[] primes = new boolean[n + 1];\n         Arrays.fill(primes, true);\n         primes[0] = primes[1] = false;\n\n        for (int p = 2;p <= n; p++) {\n          if (primes[p] && (long)p*p<=n) {\n            for (int  i = p * p; i <= n; i += p) {\n                 primes[i] = false;\n                       }\n                 }\n           }\n\n    return primes;\n     }\n}\n```
['Java']