我需要在循环中创建一些 BitSet,例如:
ArrayList<BitSet> bitSetList = new ArrayList<BitSet>();
for (int x : array) {
bitsetList.add(new BitSet() //and set bits in specific places)
}
Run Code Online (Sandbox Code Playgroud)
(要创建 BitSet 并设置特定位,)您可以使用以下之一:
static BitSet valueOf(byte[] bytes) /**
Returns a new bit set containing all the bits in the given byte array.**/
Run Code Online (Sandbox Code Playgroud)
static BitSet valueOf(long[] longs) /**
Returns a new bit set containing all the bits in the given long array.*//
Run Code Online (Sandbox Code Playgroud)
static BitSet valueOf(ByteBuffer bb) /**
Returns a new bit set containing all the bits in the
given byte buffer between its position and limit.**/
Run Code Online (Sandbox Code Playgroud)
static BitSet valueOf(LongBuffer lb) /**Returns a new bit set containing all the bits in the
given long buffer between its position and limit.**/
Run Code Online (Sandbox Code Playgroud)
API-DOC:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/BitSet.html
| 归档时间: |
|
| 查看次数: |
457 次 |
| 最近记录: |