What i understood is you want to convert filed value (a String) into BCD format.
try baove code:
Main Topics
Browse All TopicsI need to send the field value in bcd format and then encode using base64. The field value consist of 40 digits (number) and how can i convert it into 20 bytes (bcd) format in java. Any body know the solution?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Actually, i'm developing a messaging system to interface with Visa and they request us to make the Transaction ID field value into 20 bytes and encode using the base64. Let say, the transaction ID is "123243012334344000". What should i do in order to get the 20 bytes value?. I must pad it into 40 char and then call the above function to convert it to BCD format
There are some complexities you haven't covered - and your consuming application might be expecting sign or decimal point, and will probably expect them in a specific format. See:
http://en.wikipedia.or
BUT
the following code should work:
On second thought I guess I'm just not clear on what you are asking for. Please explain in further detail what you want - . Are you asking about rendering Java Strings as character encodings and then rendering those into BCD?. If so, which character encoding. It matters a great deal. They are all, of course, ultimately just numbers, and can be encoded as BCD. It would be better if you could be more explicit.
>>Actually, i'm developing a messaging system to interface with Visa and they request us to make the Transaction ID field value into 20 bytes and encode using the base64.
Are you now saying that the id can contain characters as well? If so, which ones, and what basic encoding do they want you to use?
Business Accounts
Answer for Membership
by: dravidnsrPosted on 2009-10-09 at 02:33:49ID: 25533375
http://forums.devx.com/sho wthread.ph p?t=60964