code: public int get_bits(int number_of_bits)
    {
    	int				returnvalue = 0;
    	int 			sum = bitindex + number_of_bits;
  
  	// E.B
  	// There is a problem here, wordpointer could be -1 ?!
      if (wordpointer < 0) wordpointer = 0;
      // E.B : End.
  
    	if (sum <= 32)
    	{
  	   // all bits contained in *wordpointer
  	   returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits];
  	   // returnvalue = (wordpointer[0] >> (32 - sum)) & bitmask[number_of_bits];
  	   if ((bitindex += number_of_bits) == 32)
  	   {
  		 bitindex = 0;
  		 wordpointer++; // added by me!
  	   }
  	   return returnvalue;
      }
  
      // E.B : Check that ?
      //((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
      //wordpointer++; // Added by me!
      //((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
  	int Right = (framebuffer[wordpointer] & 0x0000FFFF);
  	wordpointer++;
  	int Left = (framebuffer[wordpointer] & 0xFFFF0000);
  	returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16)& 0x0000FFFF);
  
      returnvalue >>>= 48 - sum;	// returnvalue >>= 16 - (number_of_bits - (32 - bitindex))
      returnvalue &= bitmask[number_of_bits];
      bitindex = sum - 32;
      return returnvalue;
  }
docs: Read bits from buffer into the lower bits of an unsigned int.
  The LSB contains the latest read bit of the stream.
  (1 <= number_of_bits <= 16)