encodeUpcA

Encodes a 12-digit UPC-A payload as the equivalent EAN-13 symbol.

UPC-A is EAN-13 with an implicit leading 0, so this prepends 0 and delegates to encode, which then computes/verifies the check digit.

Parameters

data

12 digits: 11 data digits plus the UPC-A check digit, or 11 data digits when the check digit should be computed. Because EAN-13's own rules apply after prefixing, pass the full 11-digit body plus the check digit (12 total) to verify, or 11 digits to have it computed.

Throws

IllegalArgumentException

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