private int nextLesserThan8Bits(int bitsToGet) {
		byte b;
		byte next;
		int l = data.length - 1;
		int bp = this.bytePointer;

		if (fillOrder == 1) {
			b = data[bp];
			if (bp == l) {
				next = 0x00;
			} else {
				next = data[bp + 1];
			}
		} else if (fillOrder == 2) {
			b = flipTable[data[bp] & 0xff];
			if (bp == l) {
				next = 0x00;
			} else {
				next = flipTable[data[bp + 1] & 0xff];
			}
		} else {
			throw new RuntimeException("tag must be either 1 or 2."); //$NON-NLS-1$
		}

		int bitsLeft = 8 - bitPointer;
		int bitsFromNextByte = bitsToGet - bitsLeft;

		int shift = bitsLeft - bitsToGet;
		int i1;
		int i2;
		if (shift >= 0) {
			i1 = (b & table1[bitsLeft]) >>> shift;
			bitPointer += bitsToGet;
			if (bitPointer == 8) {
				bitPointer = 0;
				bytePointer++;
			}
		} else {
			i1 = (b & table1[bitsLeft]) << (-shift);
			i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte);

			i1 |= i2;
			bytePointer++;
			bitPointer = bitsFromNextByte;
		}

		return i1;
	}