public final class ModUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int |
calculateLuhnMod10Check(List<Integer> digits)
Calculate Luhn Modulo 10 checksum (Luhn algorithm implementation)
|
static int |
calculateMod10Check(List<Integer> digits,
int multiplier,
int weight)
Calculate Generic Modulo 10 checksum
|
static int |
calculateMod11Check(List<Integer> digits)
Calculate Modulo 11 checksum assuming that the threshold is Integer.MAX_VALUE
|
static int |
calculateMod11Check(List<Integer> digits,
int threshold)
Calculate Modulo 11 checksum
|
static int |
calculateModXCheckWithWeights(List<Integer> digits,
int moduloParam,
int threshold,
int... weights)
Calculate Modulo
moduloParam checksum with given weights. |
public static int calculateLuhnMod10Check(List<Integer> digits)
digits
- The digits over which to calculate the checksumpublic static int calculateMod10Check(List<Integer> digits, int multiplier, int weight)
digits
- The digits over which to calculate the checksummultiplier
- Multiplier used for the odd digits in the algorithmweight
- Multiplier used for the even digits in the algorithmpublic static int calculateMod11Check(List<Integer> digits, int threshold)
digits
- the digits for which to calculate the checksumthreshold
- the threshold for the Mod11 algorithm multiplier growthpublic static int calculateMod11Check(List<Integer> digits)
digits
- the digits for which to calculate the checksumpublic static int calculateModXCheckWithWeights(List<Integer> digits, int moduloParam, int threshold, int... weights)
moduloParam
checksum with given weights. If no weights are provided then weights similar to Modulo 11 checksum will be used.
In case when there will be not enough weights provided the ones provided will be used in a looped manner.digits
- the digits for which to calculate the checksummoduloParam
- modulo parameter to be usedweights
- weights for the sum.Copyright © 2021 JBoss by Red Hat. All rights reserved.