IBM has a Redbook on the subject, "IBM Technology for Java Virtual
Machine in IBM i5/OS"

http://www.redbooks.ibm.com/Redbooks.nsf/RedbookAbstracts/SG247353.html


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Neill Harper
Sent: Saturday, August 16, 2008 2:24 PM
To: 'Java Programming on and around the iSeries / AS400'
Subject: RE: DecimalFormatter.format(object) gives strange results on
i5JVM1.4Classic

Brilliant, thanks very much!! I thought I was going mad.

I'm actually calling this java from RPG, we don't seem to have 1.5
installed
on our box. Any advice on whether or not to use/instal the 32 bit
version of
the JVM and how to control which jvm is used when calling from RPG.

Once again thanks for your help

Neill

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Joe Sam Shirah
Sent: 16 August 2008 20:03
To: Java Programming on and around the iSeries / AS400
Subject: Re: DecimalFormatter.format(object) gives strange results on i5
JVM1.4Classic


See:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4018937

Wasn't corrected until 1.5. Yet Another Reason to move to at least
WAS
6.1 and dump JDK 1.4.2 altogether.


Joe Sam

Joe Sam Shirah - http://www.conceptgo.com
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400

----- Original Message -----
From: "Neill Harper" <neill.harper@xxxxxxxx>
To: <java400-l@xxxxxxxxxxxx>
Sent: Saturday, August 16, 2008 9:13 AM
Subject: DecimalFormatter.format(object) gives strange results on i5 JVM

1.4Classic


When I run the following in WDSC and netbeans I get the result I would
expect. However when I run it on the i5 JVM 1.4 I get an unexpected
result.
I'm probably missing something really obvious, any help would be
appreciated.



public static void main(String[] args) {



BigDecimal num = new
BigDecimal("123456789987654321123456789987");

DecimalFormat df = new DecimalFormat();

df.setMaximumFractionDigits(99);

df.setMaximumIntegerDigits(99);

df.setMinimumFractionDigits(3);

df.setMinimumIntegerDigits(3);



df.setGroupingUsed(true);

df.setGroupingSize(3);



String s = df.format(num);



System.out.println(s);





}



Result in WDSC and Netbeans s =
"123,456,789,987,654,321,123,456,789,987.000"



Result when run on i5 s =
"123,456,789,987,654,321,123,300,000,000.000"



Thanks for taking a look.



Neill



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.