on 10-24-2009 10:20 AM
Hi,
I'm using NW EP 7.0.
I prepared a web dynpro java application and called a RFC function.
RFC gets bigDecimal typed output value, i must round it.
I searched but i did not find the rounding bigDecimal in jdk 1.4 environment.
How can i do that?
Thanks.
Hi,
Try this code to round the bigdecimal values.
BigDecimal aDecimal = new BigDecimal"0.195");
BigDecimal another = aDecimal.setScale(2,aDecimal.ROUND_HALF_DOWN);
System.out.println("bigd = "+aDecimal);
System.out.println("bigd1 = "+another);
Hope it helps.
Regards,
Gayathri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check this line
http://www.roseindia.net/java/java-bigdecimal/round.shtml
show the code to help rounding of the bigdecimal values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check: http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html
What you need is to set a scale and provide a Rounding Method. Rounding methods are defined as constants (int) inside the BigDecimal class.
That should solve your problem
Jan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.