Java
/** * Calculates the checksum in compliance with the ISO 1155 standard * More info: http://en.wikipedia.org/wiki/Longitudinal_redundancy_check * @param data array to calculate checksum for * @return returns the calculated checksum in byte format */ public byte calculateLRC(byte data) { byte checksum = 0; for (int i = 0; i < data.length; i++) { checksum = (byte) ((checksum + data) & 0xFF); } checksum = (byte) (((checksum ^ 0xFF) + 1) & 0xFF); return checksum; }Read more about this topic: Longitudinal Redundancy Check