correctBits(rawbits) {
			let gf;
			let codewordSize;
			if (this.ddata.getNbLayers() <= 2) {
				codewordSize = 6;
				gf = GenericGF.AZTEC_DATA_6;
			}
			else if (this.ddata.getNbLayers() <= 8) {
				codewordSize = 8;
				gf = GenericGF.AZTEC_DATA_8;
			}
			else if (this.ddata.getNbLayers() <= 22) {
				codewordSize = 10;
				gf = GenericGF.AZTEC_DATA_10;
			}
			else {
				codewordSize = 12;
				gf = GenericGF.AZTEC_DATA_12;
			}
			let numDataCodewords = this.ddata.getNbDatablocks();
			let numCodewords = rawbits.length / codewordSize;
			if (numCodewords < numDataCodewords) {
				throw new FormatException();
			}
			let offset = rawbits.length % codewordSize;
			let dataWords = new Int32Array(numCodewords);
			for (let i = 0; i < numCodewords; i++, offset += codewordSize) {
				dataWords[i] = Decoder.readCode(rawbits, offset, codewordSize);
			}
			try {
				let rsDecoder = new ReedSolomonDecoder(gf);
				rsDecoder.decode(dataWords, numCodewords - numDataCodewords);
			}
			catch (ex) {
				throw new FormatException(ex);
			}
			// Now perform the unstuffing operation.
			// First, count how many bits are going to be thrown out as stuffing
			let mask = (1 << codewordSize) - 1;
			let stuffedBits = 0;
			for (let i = 0; i < numDataCodewords; i++) {
				let dataWord = dataWords[i];
				if (dataWord === 0 || dataWord === mask) {
					throw new FormatException();
				}
				else if (dataWord === 1 || dataWord === mask - 1) {
					stuffedBits++;
				}
			}
			// Now, actually unpack the bits and remove the stuffing
			let correctedBits = new Array(numDataCodewords * codewordSize - stuffedBits);
			let index = 0;
			for (let i = 0; i < numDataCodewords; i++) {
				let dataWord = dataWords[i];
				if (dataWord === 1 || dataWord === mask - 1) {
					// next codewordSize-1 bits are all zeros or all ones
					correctedBits.fill(dataWord > 1, index, index + codewordSize - 1);
					// Arrays.fill(correctedBits, index, index + codewordSize - 1, dataWord > 1);
					index += codewordSize - 1;
				}
				else {
					for (let bit = codewordSize - 1; bit >= 0; --bit) {
						correctedBits[index++] = (dataWord & (1 << bit)) !== 0;
					}
				}
			}
			return correctedBits;
		}
<p>Performs RS error correction on an array of bits.</p>

@return the corrected array
@throws FormatException if the input contains too many errors