Class EAN13CheckDigit

    • Field Detail

      • EAN13_CHECK_DIGIT

        public static final CheckDigit EAN13_CHECK_DIGIT
        Singleton EAN-13 Check Digit instance
    • Constructor Detail

      • EAN13CheckDigit

        public EAN13CheckDigit()
        Construct a modulus 10 Check Digit routine for EAN/UPC.
    • Method Detail

      • weightedValue

        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.

        Specified by:
        weightedValue in class ModulusCheckDigit
        Parameters:
        charValue - The numeric value of the character.
        leftPos - The position of the character in the code, counting from left to right
        rightPos - The positionof the character in the code, counting from right to left
        Returns:
        The weighted value of the character.