protected void CalculateErrorCorrection(int dest) {
if (errorLevel < 0 || errorLevel > 8)
errorLevel = 0;
int[] A = ERROR_LEVEL[errorLevel];
int Alength = 2 << errorLevel;
for (int k = 0; k < Alength; ++k)
codewords[dest + k] = 0;
int lastE = Alength - 1;
for (int k = 0; k < lenCodewords; ++k) {
int t1 = codewords[k] + codewords[dest];
for (int e = 0; e <= lastE; ++e) {
int t2 = (t1 * A[lastE - e]) % MOD;
int t3 = MOD - t2;
codewords[dest + e] = ((e == lastE ? 0 : codewords[dest + e + 1]) + t3) % MOD;
}
}
for (int k = 0; k < Alength; ++k)
codewords[dest + k] = (MOD - codewords[dest + k]) % MOD;
}