code: public void add_bits (int bitstring, int length)
    {
    	int bitmask = 1 << (length - 1);
    	do
  	 if (((crc & 0x8000) == 0) ^ ((bitstring & bitmask) == 0 ))
  	 {
  		crc <<= 1;
  		crc ^= polynomial;
  	 }
  	 else
  		crc <<= 1;
    	while ((bitmask >>>= 1) != 0);
    }
docs: Feed a bitstring to the crc calculation (0 < length <= 32).