int calculateCrc(List<int> data) { int fcs = 0xffff; for (int b in data) { int index = (fcs ^ b) & 0xff; fcs = (fcs >> 8) ^ crcTab[index]; } return fcs ^ 0xffff; }