How do I round a double to 5 decimal places, without using DecimalFormat?
DecimalFormat
If you are okay with external libraries, you can have a look at microfloat, specifically MicroDouble.toString(double d, int length).