java.lang.ArrayIndexOutOfBoundsException
Name[] n = new Name[index?ninds:nsyms];
int j = 0;
for(int i=0;i<defined.length;i++){
if( defined[i] == 0 )
continue;
Name tn = Name.get(i);
if(tn==null)continue;
if( tn.isIndex() != index )
continue;
n[j++] = tn; am getting error here
}
for(int i=1;i<n.length;i++){
Name tn = n[i];
if(tn==null)continue;
String t = n[i].getSortKey();
j = i - 1;
while( j >= 0 && n[j].getSortKey().compareTo(t) > 0 ){
n[j+1] = n[j];
--j;
}
n[++j] = tn;
}
return n;
}
Re: java.lang.ArrayIndexOutOfBoundsException
When posting code, please use the highlight tags. Unformatted code is very hard to read. Also, code should be posted in the form of an SSCCE. What is the actual text and stack trace of the error?
How many indexes does that array have? What index are you trying to access? Use a debugger or print statements to figure out exactly what's going on.