Ported r2454 from ZXing

Original commit message: "Issue 1376 Check EAN13 checksum when encoding"