hey everybody, i was writing a java program and i could not figure out how to round a number[double] to 4 decimal places...i tried a lot of things(adsbygoogle = window.adsbygoogle || []).push({});

the math function's round function rounds the double to one decimal place so that does not work.

i tried various algorithms like dividing by .0001 and then rounded it and stored it into an integer and then divided the integer by 1000...still not working

please help me out...even non-java programmers can help by telling me the algorithm....thank u.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Urgent help needed !

**Physics Forums | Science Articles, Homework Help, Discussion**