Greetings,

I'm creating a barcode application and when I google to know about barcode I found something that I did not understand and it is the odd left, even left and right digits for example the EAN-13 barcode includes the following

OddLeft = new String[] { "0001101", "0011001", "0010011", "0111101",
                                          "0100011", "0110001", "0101111", "0111011",
                                          "0110111", "0001011" };

EvenLeft = new String[] { "0100111", "0110011", "0011011", "0100001",
                                           "0011101", "0111001", "0000101", "0010001",
                                           "0001001", "0010111" };

Right = new String[] { "1110010", "1100110", "1101100", "1000010",
                                        "1011100", "1001110", "1010000", "1000100",
                                        "1001000", "1110100" };

Where every string within the string array represents a number from 0 to 9.
How can decimal 0 equals "0001101" in odd left or "0100111" in even left or "1110010" in right. How did they calculate it?
I know the binary representation of decimal 0 and none of the 3 representations above represents a binary represetation of decimal 0.
I read about parity bits too and I found the none of the 3 representations above represents odd or even parity bits of decimal 0.

Is those representations above are standard fixed representation? or there is a way or a calcuation performed to obtain such representation?

Are you referring to calculating the EAN-13 check digit to check for errors?
If that is what you are after, EAN check digits are calculated by summing the odd position numbers and multiplying by 3 and then by adding the sum of the even position numbers. Numbers are examined going from right to left, so the first odd position is the last digit in the code. The final digit of the result is subtracted from 10 to calculate the check digit (or left as-is if already zero)
(taken from wikipedia).

My question is not about how to, if the expression is permissible, extract a barcode or how any barcode symbology is extracted but my question is about why when you facing the number 0 in a given number, for example, 00445671298 and you want to draw the barcode for this number and you are using the EAN-13 barcode you have one of 3 representation for 0 which are 0001101, 0100111, or 1110010. How we got those representation? Are this a standard representation for number 0 in EAN-13 barcode?. In other words, there are standards for everthing, for example, when you try to define a variable in C# you have to write is that way

datatype variableName = value

This is a standard syntax you cannot change it any way or replace position of its components like writing the variable name before the data type. So you have a standard you must follow. So if I am going to draw an EAN-13 barcode can I represent the 0 number in the number to be converted and drawn to, for example, 0000101. I hope my question is clearly explained

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.