1——
bits = new int[((length - 1) >> 5) + 1];
实例化int数组bits,之所以>>5是因为一个int表示32bits,也就是把length除以32,再加1是保证当length不是32的倍数时的情况,我认为修改为下面的格式最好:
bits = new int[(length>> 5) + (length&31!=0?1:0)];2——
return (bits[index >> 5] & 1 << index) != 0;
bits[index >> 5]获取所要取的位所在的字节
1 << index,如果把它修改为1<<(index%32)就容易理解了(1<<33==1<<1),是把index指定的位置1,这样其他的位都为0,通过&操作,就可以返回指定位的值了3——
         if (value) {
            bits[index >> 5] |= 1 << index;
         }
         else {
            bits[index >> 5] &= ~(1 << index);
判断value的值,如果是1(真),则置1,否则置0
bits[index >> 5] |= 1 << index;通过或(|)操作置1
bits[index >> 5] &= ~(1 << index);通过与(&)操作置0,由于置0时需要把指定的位置零,其他位置,操作比较麻烦,所以通过相反的操作:指定位置1其他位置0然后再取反达到目的。