• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting precision for a double value  RSS feed

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've a doubt concerning a double value. Is it possible to set it's precision to 2, i.e I want the number to be displayed only upto 2 decimal places. Thanks in advance.
Rebecca
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To format numbers to a specific number of decimal places, you can use the java.text.DecimalFormat class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!