There is supposedly a great reason why we cannot consider a signed int as unsigned: the original Java developers thought unsigned support was an unnecessary complication, since unsigned arithmetic could be confused . Since then, this has not been a problem for Java.
As verdesmerald mentioned , since there is no clear record of why (hash & 0x7FFFFFFF) % tab.length was chosen because of your smart modding, although we can find justifications for the solution, in the end we can only reflect on why this was done.
One endpoint of semantics, which is probably not so important: it is not so much that the Hashtable does not use negative hash codes, because the hash codes are โtranslatedโ into non-negative form for the index.
Gregory gan
source share