if (from < 0 || from > to) throw new IndexOutOfBoundsException(); BitSet bs = new BitSet(to - from); int lo_offset = from >>> 6; if (lo_offset >= bits.length) return bs;  int lo_bit = from & LONG_MASK; int hi_offset = to >>> 6; if (lo_bit == 0) { int len = Math.min(hi_offset - lo_offset + 1, bits.length - lo_offset); System.arraycopy(bits, lo_offset, bs.bits, 0, len); if (hi_offset < bits.length) bs.bits[hi_offset - lo_offset] &= (1L << to) - 1; return bs; }  int len = Math.min(hi_offset, bits.length - 1); int reverse = 64 - lo_bit; int i; for (i = 0; lo_offset < len; lo_offset++, i++) bs.bits[i] = ((bits[lo_offset] >>> lo_bit) | (bits[lo_offset + 1] << reverse)); if ((to & LONG_MASK) > lo_bit) bs.bits[i++] = bits[lo_offset] >>> lo_bit; if (hi_offset < bits.length) bs.bits[i - 1] &= (1L << (to - from)) - 1; return bs;
int offset = pos >> 6; if (offset >= bits.length) return false;   return (bits[offset] & (1L << pos)) != 0;
  public BitSet get(int from, int to)  {    if (from < 0 || from > to)      throw new IndexOutOfBoundsException();    BitSet bs = new BitSet(to - from);    int lo_offset = from >>> 6;    if (lo_offset >= bits.length)      return bs;    int lo_bit = from & LONG_MASK;    int hi_offset = to >>> 6;    if (lo_bit == 0)      {        int len = Math.min(hi_offset - lo_offset + 1, bits.length - lo_offset);        System.arraycopy(bits, lo_offset, bs.bits, 0, len);        if (hi_offset < bits.length)          bs.bits[hi_offset - lo_offset] &= (1L << to) - 1;        return bs;      }    int len = Math.min(hi_offset, bits.length - 1);    int reverse = 64 - lo_bit;    int i;    for (i = 0; lo_offset < len; lo_offset++, i++)      bs.bits[i] = ((bits[lo_offset] >>> lo_bit)                    | (bits[lo_offset + 1] << reverse));    if ((to & LONG_MASK) > lo_bit)      bs.bits[i++] = bits[lo_offset] >>> lo_bit;    if (hi_offset < bits.length)      bs.bits[i - 1] &= (1L << (to - from)) - 1;    return bs;  }