Class Modulo10
java.lang.Object
com.github.toolarium.security.checkdigit.AbstractModulo<Long>
com.github.toolarium.security.checkdigit.Modulo10
Implements the modulo 10 also known as LUHN.
-
Method Summary
Modifier and TypeMethodDescriptionprotected longcalculateSum(Integer[] digits) Calculate the modulo sumcreateCheckDigit(String data) Calculate the modulo 10 of the given string which contains numbers e.g.static Modulo10Get the instanceMethods inherited from class com.github.toolarium.security.checkdigit.AbstractModulo
calculateModulo, parseString, validate
-
Method Details
-
getInstance
Get the instance- Returns:
- the instance
-
createCheckDigit
Calculate the modulo 10 of the given string which contains numbers e.g.4563 9601 2200 199or446-667-65- Parameters:
data- the data to parse- Returns:
- the modulo result
- See Also:
-
calculateSum
Description copied from class:AbstractModuloCalculate the modulo sum- Specified by:
calculateSumin classAbstractModulo<Long>- Parameters:
digits- the integer digits- Returns:
- the sum
- See Also:
-