• Post Reply Bookmark Topic Watch Topic
  • New Topic

floating point round to 2.  RSS feed

 
rajendra versha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i am beginner in java i want to know how the floating point number is rounded to 2 decimal places for e.g. 12.146 should become 12.15
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rajendra xx" please read your private messages about an important administrative matter.

CR
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly you should change your name as per JavaRanch naming policy !!

And for the answer look for the 'NumberFormat' class in API docs !
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!