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