954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to Round off Floats in Java

can anyone tell me how to round off the values..

lich
Junior Poster in Training
79 posts since May 2008
Reputation Points: -1
Solved Threads: 4
 
can anyone tell me how to round off the values..

Check the Math class for problems like this: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html

VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

what i want is this

lets say 2.44534

i want to get it to

2.44

any idea how.. please help me

lich
Junior Poster in Training
79 posts since May 2008
Reputation Points: -1
Solved Threads: 4
 
Alex Edwards
Posting Shark
972 posts since Jun 2008
Reputation Points: 392
Solved Threads: 109
 

what i want is this

lets say 2.44534

i want to get it to

2.44

any idea how.. please help me

Put that in the original post. We have absolutely no way of knowing that's what you want if you don't tell us, so tell us right away so we don't have to guess. That's also rounding down, not rounding off.

VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You