aspose file tools*
The moose likes Beginning Java and the fly likes Help in Float comparison Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help in Float comparison" Watch "Help in Float comparison" New topic
Author

Help in Float comparison

Anusha Jv
Greenhorn

Joined: Jul 26, 2001
Posts: 19
Hi all,
I have two String(TextField value) which take floating point value.
I want to compare them by rounding.
Please tell the way to do it.
Thanks
Michael Fitzmaurice
Ranch Hand

Joined: Aug 22, 2001
Posts: 168
Hi
First you need to convert the Strings to floats - use <code>Float.parseFloat()</code>. Then you need to round the 2 resulting floats to ints - use <code>Math.round()</code> on them both. Then do simple int comparison to find out what you need to know.
Hope this helps

"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
Anusha Jv
Greenhorn

Joined: Jul 26, 2001
Posts: 19
Thanks It works fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help in Float comparison