ISBNs & The Modulo 11 Checksum Algorithm

ISBNs are often handled manually and there is therefore a need for a quick
way to check whether a particular ISBN is likely to be valid or not.
A typical ISBN is represented below, starting with a country code (), followed by a publisher code () and a title code (). The tenth digit (; called check-digit) depends on all the others. So if there is an alteration in one or more of the first nine digits—and the check-digit is re-calculated, its value is very likely to be different from its original value.

The Checksum Algorithm

[Compute weighted sum.]
where is the digit in the ISBN.

[Get remainder.] Divide by 11 and let be the remainder.

[Find check-digit.]

1.

[?] If , set
. The algorithm terminates

2.

[?] If , set
`X'. The algorithm terminates.

3.

[Else.] If , set
. The algorithm terminates.

Java Implementation

The following program is an implementation in Java of the above algorithm.