if(sieveArray[i]==1) {
for (long j = i* i; j < 1000000; j =j+ i)
{
int p= (int) j;
sieveArray[p] = 0;
}
This code matches to your code in video ,But not working .
It works if i
use 2i in place of ii