org.hibernate.validator.internal.util
Class ModUtil

java.lang.Object
  extended by org.hibernate.validator.internal.util.ModUtil

public final class ModUtil
extends Object

Helper class for modulo 10/11.

Author:
Hardy Ferentschik

Method Summary
static boolean passesMod10Test(List<Integer> digits, int multiplier)
          Mod10 (Luhn) algorithm implementation
static boolean passesMod11Test(List<Integer> digits, int multiplier)
          Check if the input passes the mod11 test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

passesMod11Test

public static boolean passesMod11Test(List<Integer> digits,
                                      int multiplier)
Check if the input passes the mod11 test

Parameters:
digits - The digits over which to calculate the mod 11 algorithm
multiplier - the multiplier for the modulo algorithm
Returns:
true if the mod 11 result matches the check digit, false otherwise

passesMod10Test

public static boolean passesMod10Test(List<Integer> digits,
                                      int multiplier)
Mod10 (Luhn) algorithm implementation

Parameters:
digits - The digits over which to calculate the checksum
multiplier - Multiplier used in the algorithm
Returns:
true if the mod 10 result matches the check digit, false otherwise


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