This sample implements the functionality of generating checksum number using Luhn's algorithm.
I've created a class LuhnAlgorithm with a static function:
public static int
Return value is the generated number.
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, was developed in the 1960s as a method of validating identification numbers. It is a simple checksum formula used to validate a variety of account numbers, such as credit card numbers and Canadian Social Insurance Numbers. Much of its notoriety comes from credit card companies' adoption of it shortly after its creation in the late 1960s by IBM scientist Hans Peter Luhn (1896–1964).
Explanation of the Luhn's algorithm can be found here.