Why the bounds check doesn't get eliminated?
问题 I wrote a simple benchmark in order to find out if bounds check can be eliminated when the array gets computed via bitwise and. This is basically what nearly all hash tables do: They compute h & (table.length - 1) as an index into the table , where h is the hashCode or a derived value. The results shows that the bounds check don't get eliminated. The idea of my benchmark is pretty simple: Compute two values i and j , where both are guaranteed to be valid array indexes. i is the loop counter.