If I have an output of any double or integer that needs to be rounded to a certain number of decimal places, how would I code that? As always there are many ways to do this but, again, as always, I'll be looking for the simplest way to do such a thing without compensating any viability in my program. Thanks for all the help.
IMtheBESTatJAVA -11 Light Poster
Recommended Answers
Jump to Posttried using DecimalFormat?
Jump to PostWell all I need to do is make a double like 23.5 to be 23.50 and longer ones like 23.556 to be 23.55 or 23.56. Would I do this as doublevalue = Math.round(2);? I seriously just started programming with java so sending me to those elongated complicated reference sheets won't …
All 7 Replies
stultuske 1,116 Posting Maven Featured Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
IMtheBESTatJAVA -11 Light Poster
stultuske 1,116 Posting Maven Featured Poster
IMtheBESTatJAVA -11 Light Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
orko 36 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.