THE PACKAGE JAVA.UTIL
java.util.BitSet
21.2
21.2.3
public String toString()
For every index for which this
BitSet
contains a bit in the set state, the decimal
representation of that index is included in the result. Such indices are listed in
order from lowest to highest, separated by
,
(a comma and a space) and sur
rounded by braces, resulting in the usual mathematical notation for a set of inte
gers.
Overrides the
toString
method of
Object
( 20.1.2).
Example:
BitSet drPepper = new BitSet();
Now
drPepper.toString()
returns
"{}"
.
drPepper.set(2);
Now
drPepper.toString()
returns
"{2}"
.
drPepper.set(4);
drPepper.set(10);
Now
drPepper.toString()
returns
"{2, 4, 10}"
.
21.2.4
public boolean equals(Object obj)
The result is
true
if and only if the argument is not
null
and is a
BitSet
object
such that, for every nonnegative
int
index
k
:
((BitSet)obj).get(k) == this.get(k)
Overrides the
equals
method of
Object
( 20.1.3).
21.2.5
public int hashCode()
The hash code depends only on which bits have been set within this
BitSet
. The
algorithm used to compute it may be described as follows.
Suppose the bits in the
BitSet
were to be stored in an array of
long
integers
called, say,
bits
, in such a manner that bit
k
is set in the
BitSet
(for nonnegative
values of
k
) if and only if the expression:
((k>>6) < bits.length) &&
((bits[k>>6] & (1L << (bit & 0x3F))) != 0)
is true. Then the following definition of the
hashCode
method would be a correct
implementation of the actual algorithm:
619
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved