BitSet.valueOf(LongBuffer): This method is available in java.util.BitSet class of Java.
Syntax:
BitSet java.util.BitSet.valueOf(LongBuffer lb)
This method takes one argument of type LongBuffer as its parameter. This method returns a new bit set containing all the bits in the given long buffer between its position and limit.
Parameters: One parameter is required for this method.
lb: a long buffer containing a little-endian representation of a sequence of bits between its position and limit, to be used as the initial bits of the new bit set.
Returns: a BitSet containing all the bits in the buffer in the specified range.
Exceptions: NA
Approach
Java
import java.nio.LongBuffer;import java.util.BitSet;public class BitSetvalueOfLongBuffer {public static void main(String[] args) {long array[] = { 1, 4, 6, 7 };LongBuffer longBuffer = LongBuffer.wrap(array);System.out.println(BitSet.valueOf(longBuffer));}}
Output:
{0, 66, 129, 130, 192, 193, 194}
No comments:
Post a Comment