I have resolved the Problem presented in Project Euler #10:The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.But this code takes too long before producing a result, 12.4195167 minutes to be exact.What should I do to optimize this code?public class summationOfPrimes{public static void main(String args[]){    long sum=0;    outerloop:    for(int i=2;i<2000000;i++){        for(int j=2;j<=i;j++){            if(i!=j&&i%j==0){                continue outerloop;            }            else if(j==i){                sum=sum+i;            }        }    }    System.out.println(sum);}}
Project Euler #10 -- Summation of primes takes forever
java;performance;programming challenge;primes;time limit exceeded