public final class EAN13CheckDigit extends ModulusCheckDigit
Check digit calculation is based on modulus 10 with digits in an odd position (from right to left) being weighted 1 and even position digits being weighted 3.
For further information see:
| Modifier and Type | Field and Description |
|---|---|
static CheckDigit |
EAN13_CHECK_DIGIT
Singleton EAN-13 Check Digit instance
|
| Constructor and Description |
|---|
EAN13CheckDigit()
Construct a modulus 10 Check Digit routine for EAN/UPC.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
weightedValue(int charValue,
int leftPos,
int rightPos)
Calculates the weighted value of a character in the
code at a specified position.
|
calculate, calculateModulus, getModulus, isValid, sumDigits, toCheckDigit, toIntpublic static final CheckDigit EAN13_CHECK_DIGIT
public EAN13CheckDigit()
protected int weightedValue(int charValue,
int leftPos,
int rightPos)
Calculates the weighted value of a character in the code at a specified position.
For EAN-13 (from right to left) odd digits are weighted with a factor of one and even digits with a factor of three.
weightedValue in class ModulusCheckDigitcharValue - The numeric value of the character.leftPos - The position of the character in the code, counting from left to rightrightPos - The positionof the character in the code, counting from right to leftCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.