This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Double Value  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a double value which prints a lot of digits after the decimal.
how do i control the number of digits after the decimal.
regards
 
author and iconoclast
Sheriff
Posts: 24219
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the java.text.DecimalFormat class to prepare formatted Strings from your double value -- i.e.,

prints 123.456 .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!