Skip to content
Advertisement

What do Bitset size() and length() mean, and what is the difference between them?

I don’t quite understand the different meanings of size() and length() in BitSet. Check the code below:

JavaScript

Output is:

JavaScript

I thought I would get something like

JavaScript

Where do these trailing zeroes come from? Can someone explain this to me? thanks~~

Advertisement

Answer

answer is quite simple the BitSet constructor just says it generates something which is big enough to the given size, actually it takes some internal size which is best matching.

And in your case this is 64 bit, see JavaDoc

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement