org.databene.benerator.util
Class LuhnUtil

java.lang.Object
  extended by org.databene.benerator.util.LuhnUtil

public class LuhnUtil
extends java.lang.Object

Provides utility methods for Luhn check digit calculation.

Created: 18.10.2009 10:06:01

Since:
0.6.0
Author:
Volker Bergmann

Method Summary
static boolean luhnValid(java.lang.CharSequence number)
          Tests a number against the Luhn algorithm
static char requiredCheckDigit(java.lang.CharSequence number)
          Calculates the last digit expected for a number that passes the Luhn test, ignoring the last digit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

requiredCheckDigit

public static char requiredCheckDigit(java.lang.CharSequence number)
Calculates the last digit expected for a number that passes the Luhn test, ignoring the last digit. This is useful for creating Luhn numbers. The actual evaluation if a number passes the test is done by luhnValid(CharSequence).

See Also:
"http://en.wikipedia.org/wiki/Luhn_algorithm"

luhnValid

public static boolean luhnValid(java.lang.CharSequence number)
Tests a number against the Luhn algorithm

See Also:
requiredCheckDigit(CharSequence), "http://en.wikipedia.org/wiki/Luhn_algorithm"


Copyright © 2013. All Rights Reserved.