Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I use packed decimal values in a Java program?

decimal Java packed program values
0
Posted

How do I use packed decimal values in a Java program?

0

In Java, the best way to represent decimal numbers is by using the com.ibm.math.BigDecimal class. It is included with all IBM JVMs (including the one for OS/390 and z/OS) and provides a superior decimal implementation over java.math.BigDecimal. JSR13 proposes to make this a part of Java itself. To convert numbers to BigDecimal from a byte array containing a packed decimal number, I use a routine that travels down the byte array and builds a StringBuffer to pass to the BigDecimal constructor. I’m going to experiment with some other techniques that may be more efficient but that is what I’m using for now.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123