Java BitSet longToBitSet(long value)

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

Description

Convert a BitSet to its equivalent integer (long) value.

License

Apache License

Parameter

Parameter Description
value a parameter

Declaration

public static BitSet longToBitSet(long value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.BitSet;

public class Main {
    /**/* ww  w  .  j  av a2 s  .c  o m*/
     * Convert a BitSet to its equivalent integer (long) value.
     *
     * @param value
     * @return
     */
    public static BitSet longToBitSet(long value) {
        BitSet bits = new BitSet(Long.SIZE);
        int index = 0;
        while (value != 0L) {
            long rem = value % 2L;
            if (rem != 0) {
                bits.set(index);
            }
            ++index;
            value = value >>> 1;
        }
        return bits;
    }
}

Related

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