Java BitSet longToBitSet(long bits)

Here you can find the source of longToBitSet(long bits)

Description

long To Bit Set

License

Open Source License

Declaration

public static BitSet longToBitSet(long bits) 

Method Source Code

//package com.java2s;

import java.util.BitSet;

public class Main {
    public static BitSet longToBitSet(long bits) {
        BitSet ret = new BitSet();
        for (int count = 0;; count++) {
            long curBit = 1L << count;
            ret.set(count, (bits & curBit) != 0);
            if (curBit >= bits)
                break;
        }//from   w w w.  j av  a 2s.co m
        return ret;
    }
}

Related

  1. isSet(int n, BitSet... sets)
  2. isSubset(BitSet bits1, BitSet bits2)
  3. isSubset(BitSet subsetToTest, BitSet supersetToTest)
  4. isSubSet(BitSet x, BitSet y)
  5. longFrom(final BitSet bitSet)
  6. longToBitSet(long value)
  7. mapToBitSet(Map map, String key)
  8. max(BitSet bits)
  9. members(BitSet set)