int pq = (reference[ofs] & 0xFF) / 16;
int pq = (reference[ofs] & 0xFF) >> 4;
public void scaleBy(int qualityFactor) {	int qFactor = qualityFactor;	if (qFactor <= 0) {		qFactor = 1;	}	if (qFactor > 100) {		qFactor = 100;	}	if (qFactor < 50) {		qFactor = 5000 / qFactor;	} else {		qFactor = 200 - (qFactor * 2);	}	int totalLength = getSegmentLength() - 2;	int ofs = 4;	while (totalLength > 64) {//		int tq = (reference[ofs] & 0xFF) % 16;		int pq = (reference[ofs] & 0xFF) / 16;		if (pq == 0) {			for (int i = ofs + 1; i <= ofs + 64; i++) {				int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100;				if (temp <= 0) temp = 1;				if (temp > 255) temp = 255;				reference[i] = (byte)temp;			}			ofs += 65;			totalLength -= 65;		} else {			for (int i = ofs + 1; i <= ofs + 128; i += 2) {				int temp = (((reference[i] & 0xFF) * 256 + (reference[i + 1] & 0xFF)) * qFactor + 50) / 100;				if (temp <= 0) temp = 1;				if (temp > 32767) temp = 32767;				reference[i] = (byte)(temp / 256);				reference[i + 1] = (byte)(temp % 256);			}			ofs += 129;			totalLength -= 129;		}	}}