java.util.BitSet — set() doesn't work as expected

后端 未结 6 1359
借酒劲吻你
借酒劲吻你 2021-01-18 01:17

Am I missing something painfully obvious? Or does just nobody in the world actually use java.util.BitSet?

The following test fails:

@Test
public voi         


        
6条回答
  •  悲哀的现实
    2021-01-18 01:33

    Given that the bitset is backed by a long[], the minimum size is 64 (because 1 long is 64 bits). The size gets incremented by a multiple of 64 and for some reason, they have not maintained the # of bits you intended to represent when you use the constructor that takes an int.

提交回复
热议问题