org.hibernate.validator.internal.util

## Class ModUtil

- java.lang.Object
- - org.hibernate.validator.internal.util.ModUtil

-     public final class ModUtil
      extends Object

  Helper class for modulo 10/11.
  Author:
    Hardy Ferentschik

- - ### Method Summary

    Methods
    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)` Calculate Generic Modulo 10 checksum
    `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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### calculateLuhnMod10Check

          public static int calculateLuhnMod10Check(List<Integer> digits)

      Calculate Luhn Modulo 10 checksum (Luhn algorithm implementation)
      Parameters:
        `digits` - The digits over which to calculate the checksum
      Returns:
        the result of the mod10 checksum calculation

    - #### calculateMod10Check

          public static int calculateMod10Check(List<Integer> digits,
                                int multiplier,
                                int weight)

      Calculate Generic Modulo 10 checksum
      Parameters:
        `digits` - The digits over which to calculate the checksum
        `multiplier` - Multiplier used for the odd digits in the algorithm
        `weight` - Multiplier used for the even digits in the algorithm
      Returns:
        the result of the mod10 checksum calculation

    - #### calculateMod10Check

          public static int calculateMod10Check(List<Integer> digits,
                                int multiplier)

      Calculate Generic Modulo 10 checksum
      Parameters:
        `digits` - The digits over which to calculate the checksum
        `multiplier` - Multiplier used in the algorithm
      Returns:
        the result of the mod10 checksum calculation assuming weight = 1

    - #### calculateMod11Check

          public static int calculateMod11Check(List<Integer> digits,
                                int threshold)

      Calculate Modulo 11 checksum
      Parameters:
        `digits` - the digits for which to calculate the checksum
        `threshold` - the threshold for the Mod11 algorithm multiplier growth
      Returns:
        the result of the mod11 checksum calculation

    - #### calculateMod11Check

          public static int calculateMod11Check(List<Integer> digits)

      Calculate Modulo 11 checksum assuming that the threshold is Integer.MAX_VALUE
      Parameters:
        `digits` - the digits for which to calculate the checksum
      Returns:
        the result of the mod11 checksum calculation

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved