import static java.lang.String.format;
+import java.math.BigInteger;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
return new BitVector(values);
}
+ public static BitVector of(long value, int bits)
+ {
+ return of(BigInteger.valueOf(value), bits);
+ }
+
+ public static BitVector of(BigInteger value, int bits)
+ {
+ Bit[] values = new Bit[bits];
+ for (int i = 0; i < bits; i++)
+ {
+ values[bits - i - 1] = Bit.of(value.testBit(i));
+ }
+ return new BitVector(values);
+ }
+
/**
* Iterate over the {@link Bit}s of the BitVector <b>from MSB to LSB</b> (left to right).
*/