code: public static final int readBits(int[] in, final int inOffset,
                  final int bits) {
                  final int index = inOffset >>> 5;
                  final int skip = inOffset & 0x1f;
                  int val = in[index] >>> skip;
                  if (32 - skip < bits) {
                          val |= (in[index + 1] << (32 - skip));
                  }
                  return val & (0xffffffff >>> (32 - bits));
          }
docs: Read a certain number of bits of an integer into an integer array
  starting from the given start offset
  
  @param in
  the input array
  @param inOffset
  the start offset in bits in the input array
  @param bits
  the number of bits to be read, unlike writeBits(),
  readBits() does not deal with bits==0 and thus bits
  must be greater than 0. When bits ==0, the calling functions will
  just skip the entire bits-bit slots without decoding
  them
  @return the bits bits of the input