I*i not working

i*i is not working in java
it is giving following error

Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: Index -2146737495 out of bounds for length 1000005
at helloWorld/codingBlocks.Prime_Visits.main(Prime_Visits.java:19)

Hello @sreejan123,

You might be doing some mistake that is leading to out of bound error.
Please share your code with me using Online Coding Blocks ID.

See the following code:

i*i is not the problem.


only one test cases can be passed

Hello @Sreejan-Agrahari-1580844298744219,

I have corrected your code:


Refer to comments for better understanding.

Hope, this would help.