Re: Problem with BitSet.length()...
- From: Joshua Cranmer <Pidgeot18@xxxxxxxxxxx>
- Date: Thu, 16 Aug 2007 21:32:07 GMT
Mothra wrote:
Running eightBits.length() returns zero, rather than eight.
Logically speaking, if length() returns the perceived size and not the actual size, then there would be a function that returns the actual size if it might be pertinent. This function would also have a name similar to "length", like "capacity" or "size". Capacity is used for both ArrayList and String{Builder,Buffer}, for example. Searching the Javadocs for BitSet reveals this (in the function summary table):
size() - Returns the number of bits of space actually in use by this BitSet to represent bit values.
private static int bitsToInt(BitSet bits) {
What if BitSet.size() > 32?
--
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
.
- References:
- Problem with BitSet.length()...
- From: Mothra
- Problem with BitSet.length()...
- Prev by Date: Problem with BitSet.length()...
- Next by Date: How to create virtual webservices?
- Previous by thread: Problem with BitSet.length()...
- Next by thread: How to create virtual webservices?
- Index(es):