Getting outofbound error in seive's 2nd for loop in Java

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

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.