public final class VerhoeffCheckDigit extends Object implements CheckDigit, Serializable
Check digit calculation for numeric codes using a Dihedral Group of order 10.
See Wikipedia - Verhoeff algorithm for more details.
Modifier and Type | Field and Description |
---|---|
static CheckDigit |
VERHOEFF_CHECK_DIGIT
Singleton Verhoeff Check Digit instance
|
Constructor and Description |
---|
VerhoeffCheckDigit() |
public static final CheckDigit VERHOEFF_CHECK_DIGIT
public boolean isValid(String code)
isValid
in interface CheckDigit
code
- The code to validatetrue
if the check digit is valid,
otherwise false
public String calculate(String code) throws CheckDigitException
calculate
in interface CheckDigit
code
- The code to calculate the Check Digit forCheckDigitException
- if an error occurs calculating
the check digit for the specified codeCopyright © 2002-2017 The Apache Software Foundation. All Rights Reserved.