Created
April 2, 2016 01:03
-
-
Save calderaro/a998be78005534d7e7d35335058b9f77 to your computer and use it in GitHub Desktop.
Longitudinal Redundancy Check (LRC) calculator for a byte array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LRC { | |
public static byte calculateLRC(byte[] bytes) { | |
byte LRC = 0; | |
for (int i = 0; i < bytes.length; i++) { | |
LRC ^= bytes[i]; | |
} | |
return LRC; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment