请帮忙看一下这个程序为什么会产生这样的异常
public class Primes {
public static void main(String[] args) {
int N=Integer.parseInt(args[0]);
boolean[] a;
try{
a=new boolean[N];
}catch(OutOfMemoryError e){
System.err.println("Out of Memory");
return;
}
for(int i=2;i<N;i++)a[i]=true;
for(int i=2;i<N;i++)
if(a[i]!=false)
for(int j=i;j*i<N;j++)
a[i*j]=false;
for(int i=0;i<N;i++)
if(a[i])System.out.print(" "+i);
System.out.println();
}
}
这是一个求素数的程序,当我输入100000时,程序产生Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -2146737495
at Primes.main(Primes.java:24)
这样的异常,请问这个程序为什么会产生这样的异常,还有-2146737495这个数是如何产生的,谢谢