static interleaveWithECBytes(bits, numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/) {
			// "bits" must have "getNumDataBytes" bytes of data.
			if (bits.getSizeInBytes() !== numDataBytes) {
				throw new WriterException('Number of bits and data bytes does not match');
			}
			// Step 1.  Divide data bytes into blocks and generate error correction bytes for them. We'll
			// store the divided data bytes blocks and error correction bytes blocks into "blocks".
			let dataBytesOffset = 0;
			let maxNumDataBytes = 0;
			let maxNumEcBytes = 0;
			// Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.
			const blocks = new Array(); // new Array<BlockPair>(numRSBlocks)
			for (let i = 0; i < numRSBlocks; ++i) {
				const numDataBytesInBlock = new Int32Array(1);
				const numEcBytesInBlock = new Int32Array(1);
				Encoder.getNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes, numRSBlocks, i, numDataBytesInBlock, numEcBytesInBlock);
				const size = numDataBytesInBlock[0];
				const dataBytes = new Uint8Array(size);
				bits.toBytes(8 * dataBytesOffset, dataBytes, 0, size);
				const ecBytes = Encoder.generateECBytes(dataBytes, numEcBytesInBlock[0]);
				blocks.push(new BlockPair(dataBytes, ecBytes));
				maxNumDataBytes = Math.max(maxNumDataBytes, size);
				maxNumEcBytes = Math.max(maxNumEcBytes, ecBytes.length);
				dataBytesOffset += numDataBytesInBlock[0];
			}
			if (numDataBytes !== dataBytesOffset) {
				throw new WriterException('Data bytes does not match offset');
			}
			const result = new BitArray();
			// First, place data blocks.
			for (let i = 0; i < maxNumDataBytes; ++i) {
				for (const block of blocks) {
					const dataBytes = block.getDataBytes();
					if (i < dataBytes.length) {
						result.appendBits(dataBytes[i], 8);
					}
				}
			}
			// Then, place error correction blocks.
			for (let i = 0; i < maxNumEcBytes; ++i) {
				for (const block of blocks) {
					const ecBytes = block.getErrorCorrectionBytes();
					if (i < ecBytes.length) {
						result.appendBits(ecBytes[i], 8);
					}
				}
			}
			if (numTotalBytes !== result.getSizeInBytes()) { // Should be same.
				throw new WriterException('Interleaving error: ' + numTotalBytes + ' and ' +
					result.getSizeInBytes() + ' differ.');
			}
			return result;
		}
Interleave "bits" with corresponding error correction bytes. On success, store the result in
"result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.