Skip to content

Commit 1cc4b66

Browse files
added Checksum algo and unit tests
1 parent 24ad514 commit 1cc4b66

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

‎src/main/java/com/thealgorithms/maths/Checksum.java‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
package com.thealgorithms.maths;
22

33
/**
4-
* A simple Checksum implementation for data validation.
5-
* Calculates an 8-bit checksum of a given byte array.
4+
* Checksum implementation for data validation.
5+
* Should calculate an 8 bit checksum of a given byte array
66
*/
77
public final class Checksum {
88

9-
private Checksum() {
10-
// Private constructor to prevent instantiation
9+
private Checksum() { //priv constructor
1110
}
1211

13-
/**
14-
* Calculates an 8-bit checksum for the specified input data.
15-
*
16-
* @param data the byte array to checksum
17-
* @return the 8-bit checksum value as an integer
18-
*/
12+
//Calc an 8 bit checksum for the specified input data.
1913
public static int calculateChecksum(byte[] data) {
2014
if (data == null) {
2115
throw new IllegalArgumentException("Input data cannot be null");

0 commit comments

Comments
 (0)