Java : How to create a 64 bit array in java to store larger than Integer_max-value
<p>I am trying to find the sum of primes. To execute in smaller time I have precomputed it in a long array but the last two test cases are appearing wrong. Reason is overflow i.e. max value that can be accommodated in Integer.MAX_VALUE but I am trying to provide a large value. I need this large value : </p>

<p>Test Link : <a href="https://www.hackerrank.com/contests/projecteuler/challenges/euler010/" rel="nofollow">https://www.hackerrank.com/contests/projecteuler/challenges/euler010/</a></p>

<p>This is my code  : </p>

<pre><code>import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner sc = new Scanner(System.in);
        int count,n,t;
        long ans[] = new long[10000001];
            ans[0] = 0; ans[1] = 1; ans[2] = 2; ans[3] = 5; ans[4] = 5;
       //     ans[2] = 5;
        for(int m=5;m&lt;100000;){
            count = 0;
                    if(m%2==0){
                        count++;
                    }
         //       for(int i=3;i&lt;=1000000;i++){

                    for(int j=3;j*j&lt;=m;j+=2){
                        if(m%j==0){
                //            System.out.println(i);
                            count++;
                        }
                    }
                    if(count&lt;1){
                    ans[m]=ans[m-1]+m;
           //          System.out.println(m+" : "+ans[m]);
                        m++;
                    }
                    else{
                       ans[m]=ans[m-1];
             //         System.out.println(m+" : "+ans[m]);
                        m++; 
                    }
        //        }
        } 
                t = sc.nextInt();
                while(t&gt;0){
            n = sc.nextInt();
            System.out.println(ans[n]);
            t--;
        }
    }
}
</code></pre>