public int getSample(int x, int y, int b, DataBuffer data) {  if ((x < 0) || (y < 0) || (x >= width) || (y >= height) || (b != 0)) { throw new ArrayIndexOutOfBoundsException("Coordinate out of bounds!"); } int bitnum = dataBitOffset + x * pixelBitStride; int element = data.getElem(y * scanlineStride + bitnum / dataElementSize); int shift = dataElementSize - (bitnum & (dataElementSize - 1)) - pixelBitStride; return (element >> shift) & bitMask; }
public int getSample(int x, int y, int b, DataBuffer data) { int pos = ((dataBitOffset + x * numberOfBits) % elemBits) / numberOfBits; int offset = getOffset(x, y); int samples = data.getElem(offset); return (samples & bitMasks[pos]) >>> bitOffsets[pos]; }
	public int getSample(int x, int y, int b, DataBuffer data) {		// 'b' must be 0		if ((x < 0) || (y < 0) || (x >= width) || (y >= height) || (b != 0)) {			throw new ArrayIndexOutOfBoundsException("Coordinate out of bounds!");		}		int bitnum = dataBitOffset + x * pixelBitStride;		int element = data.getElem(y * scanlineStride + bitnum / dataElementSize);		int shift = dataElementSize - (bitnum & (dataElementSize - 1)) - pixelBitStride;		return (element >> shift) & bitMask;	}