Java BitSet hashCode() method

The hashCode() method of Java BitSet class returns the hash code value of this BitSet. The value of hash code depends only on the bit which is set within this BitSet.

Syntax:

Parameter:

NA

Returns:

The hashCode() method returns the hash code value of this BitSet.

Exception:

NA

Compatibility Version:

Java 1.0 and above

Example 1

Output:

bitset1: {0, 1, 2, 3}
bitset1 hash code: 1245
bitset2: {5, 6, 7, 8}
bitset2 hash code: 1330