added calculateParity method to HammingCode