(prateek loves candy)

i am not able to understand the editorial solution to this can u please explain me this solution…also i dont unterstand the use of array here …i am a java student:
#include
#include
using namespace std;
#define MAX 10000000
vectorisPrime (MAX,true);
unsigned primearray[5761459];

void gen_primes(){
isPrime[0]=isPrime[1]=false;
for(unsigned i=2;ii<=MAX;i++){
if(isPrime[i]){
for(unsigned j=i;j
i<=MAX;j++) isPrime[i*j]=false;
}
}
unsigned idx = 1;
primearray[0]=2;

for(int i=3;i<=MAX;i+=2){
    if(isPrime[i]){
        primearray[idx++]=i;
    }     
}

}

int main(int argc, char const *argv[])
{

gen_primes();

int t;
cin>>t;
while(t--) {
    int n;
    cin>>n;
    cout<<primearray[n-1]<<endl;
}
return 0;

}