Menu

#13 ArrayIndexOutOfBoundsEx in chained hash set .add()

v1.2
open
nobody
None
5
2009-03-26
2009-03-26
Anonymous
No

The Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE by definition.
Here, the %11 return -2, thus the AIOOBE.

IntSet s = new IntChainedHashSet();
System.out.println(Math.abs(Long.MIN_VALUE));
System.out.println(Math.abs(Integer.MIN_VALUE));
s.add(Integer.MIN_VALUE); //ArrayIndexOutOfBoundsException !!!!!

Discussion


Log in to post a comment.