return bits[bit];
}
+ /** get a sub-BitVector of a BitVector */
+ public BitVector get(int high, int low) {
+ if (low < 0 || high < 0 || high>low)
+ throw new RuntimeException("attempt to invoke BitVector("+high+","+low+")");
+ if (high > length()-1)
+ throw new RuntimeException("attempt to invoke BitVector("+high+","+low+") on an "+length()+"-bit BitVector");
+ BitVector ret = new BitVector(1+high-low);
+ for(int i=low; i<=high; i++)
+ ret.set(i-low, get(i));
+ return ret;
+ }
+
public String toString() {
StringBuffer ret = new StringBuffer();
ret.append(length()+"");