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() |
Modifier and Type | Method and Description |
---|---|
String |
calculate(String code)
Calculate a Verhoeff Check Digit for a code.
|
boolean |
isValid(String code)
Validate the Verhoeff Check Digit for a code.
|
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–2020 The Apache Software Foundation. All rights reserved.