+ if (width == 1)
+ return SINGLE_BIT_MAPPING[bit.ordinal()];
+ return new BitVector(bit.makeArray(width));
+ }
+
+ public static BitVector from(long value, int bits)
+ {
+ return from(BigInteger.valueOf(value), bits);
+ }
+
+ public static BitVector from(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);