The Java .hashCode() returns int, which could be positive or negative. To use the .hashCode() as an array index, make it positive (e.g. with Math.abs()) and make it modulo the table size.
The requirements of a .hashCode() include:
The .hashCode() that is inherited from Object may use the memory address of an object as the hash code; this will differ between executions. Therefore, it is preferable to write your own .hashCode() for application data structures.