From 50d45d27beb423c1689f83401d0adb88b7fafb65 Mon Sep 17 00:00:00 2001 From: Ivan Muratov Date: Fri, 14 Jul 2017 08:48:27 +0300 Subject: Correction based on comments. Re-write modulo256 checksum's parameter to byte array, not varargs. Split the tests to two methods for HEADER ver1 and ver2. Remove above-class copyrights, added top-file copyrights. Rename parcelNumber to index. Rename recordStartSign to recordType. Remove crearing additional buffer for record data, use origin buffer instead. Added check on minimal length of packet to avoid the out-of-range exceptions. --- src/org/traccar/helper/Checksum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/org/traccar/helper/Checksum.java') diff --git a/src/org/traccar/helper/Checksum.java b/src/org/traccar/helper/Checksum.java index 7a0151d36..44cef9635 100644 --- a/src/org/traccar/helper/Checksum.java +++ b/src/org/traccar/helper/Checksum.java @@ -243,7 +243,7 @@ public final class Checksum { return (10 - (checksum % 10)) % 10; } - public static int modulo256(byte... bytes) { + public static int modulo256(byte[] bytes) { int sum = 0; for (byte b : bytes) { sum = (sum + b) & 0xFF; -- cgit v1.2.3