This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new bb98f654 Javadoc
bb98f654 is described below
commit bb98f654c2dd45b56c7a54b6cab2ca3ae1274d6b
Author: Gary D. Gregory <[email protected]>
AuthorDate: Mon Aug 18 08:45:13 2025 -0400
Javadoc
---
src/main/java/org/apache/commons/codec/digest/CRC16.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/main/java/org/apache/commons/codec/digest/CRC16.java
b/src/main/java/org/apache/commons/codec/digest/CRC16.java
index f4eddacf..19d79ef1 100644
--- a/src/main/java/org/apache/commons/codec/digest/CRC16.java
+++ b/src/main/java/org/apache/commons/codec/digest/CRC16.java
@@ -26,6 +26,15 @@ import java.util.zip.Checksum;
* <p>
* Since there are so many CRC-16 variants, we do not pick a default.
* </p>
+ * <p>
+ * To create a create a custom variant of CRC16-MODBUS with a init value of
{@code 0x0000}, call:
+ * </p>
+ * <pre>
+ * Checksum crc16 = CRC16.builder()
+ * .setTable(CRC16.getModbusTable())
+ * .setInit(0x0000)
+ * .get();
+ * </pre>
*
* @see <a href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check">Cyclic
redundancy check</a>
* @see <a href="https://reveng.sourceforge.io/crc-catalogue/16.htm">Catalogue
of parametrised CRC algorithms with 16 bits</a>