List of usage examples for org.apache.commons.validator.routines.checkdigit LuhnCheckDigit LuhnCheckDigit
public LuhnCheckDigit()
From source file:com.inkubator.common.util.CheckDigitLunh.java
/** * Check a series of number is valid or not using lunh algorithm * * @param number//from w w w . j a v a2s.com * @return Boolean */ public static Boolean isValidNumberByLunh(String number) { CheckDigit checkDigit = new LuhnCheckDigit(); return checkDigit.isValid(number); }
From source file:com.inkubator.common.util.CheckDigitLunh.java
/** * Calculate a number for the check digit * @param code// ww w . j a v a 2 s .c om * @return String code of check digit * @throws org.apache.commons.validator.routines.checkdigit.CheckDigitException */ public static String calculate(String code) throws CheckDigitException { CheckDigit checkDigit = new LuhnCheckDigit(); return checkDigit.calculate(code); }