encode

Encodes a 12- or 13-digit EAN-13 payload.

Return

the 95-module bar/space pattern, starting with a bar.

Parameters

data

12 digits (check digit computed) or 13 digits (check digit verified). Non-digit characters and other lengths are rejected.

Throws

IllegalArgumentException

if data is not 12 or 13 digits, or if a 13-digit input carries an incorrect check digit.