Package org.instancio.internal.util
Class LuhnUtils
java.lang.Object
org.instancio.internal.util.LuhnUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getCheckDigit
(char[] payload) static boolean
isLuhnValid
(int startIdx, int endIdx, int checkIdx, String s) Check whether the given string conforms to the Luhn Modulo 10 checksum algorithm.static boolean
-
Method Details
-
isLuhnValid
-
isLuhnValid
Check whether the given string conforms to the Luhn Modulo 10 checksum algorithm.See: Luhn algorithm.
- Parameters:
startIdx
- start index of the payloadendIdx
- end index of the payloadcheckIdx
- index of the check digits
- to check- Returns:
true
if the specified range of the string passes the Luhn check
-
getCheckDigit
public static int getCheckDigit(char[] payload)
-