Stack Exchange
generate code39 barcode data in java?
I'm trying to generate code39 data. It has some requirement as follows:
/*
       Code 39 Valid data char set:
            0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (Digits)
            A - Z (Uppercase letters)
            - (Dash), $ (Dollar), % (Percentage), (Space), . (Point), / (Slash), + (Plus)

       Code 39 extension Valid data char set:
            All ASCII 128 characters
    */
    // Code 39 encodes upper case chars only, for lower case chars, use Code 39 extension
    barcode.setData("123456789012");

Now I want to know if it has a length for the generated data and how to generate it?
Thanks

You want to know if what has a length?  Is this homework?  What did you try so far?

According to Wikipedia Code 39 is restricted to 43 characters.In order to generate it's encoding data I've used the following code:
String data=RandomStringUtils.random(20,0,0,true,true,null).toUpperCase();


Please consider using the Java Alphabet Library (JAL).
It is basically a library that helps you to convert between different "alphabets" like Code39 and Decimal, for instance.
You can use the provided Code39 alphabet there, and it has examples.
Useful if you want to convert a database id to the corresponding Code39, for example.
