• Post Reply Bookmark Topic Watch Topic
  • New Topic

cut off decimals of a float number  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've to print a float number.
i've a float like 0.02999, how can i cut off the decimals to round it to 0.03 ?
Thanks.
 
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the DecimalFormat class:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!