How do I implement the Luhn algorithm?

后端 未结 8 1603
被撕碎了的回忆
被撕碎了的回忆 2020-12-21 09:50

I am trying to create a program to validate 10 to 12 digit long number sequences based on the luhn algorithm, but my program keeps on telling me that every number is invalid

8条回答
  •  自闭症患者
    2020-12-21 10:21

    use org.apache.commons.validator.routines.checkdigit.LuhnCheckDigit.LUHN_CHECK_DIGIT.isValid(number)

    Maven Dependency:

    
        commons-validator
        commons-validator
        1.5.1
    
    

提交回复
热议问题