I am trying to write a java function that will take a double as it's input, and return the double formatted as a string to the minimum number of decimal places required.
E.g.
Input:Result
50.000 : 50
12.500 : 12.5
74.125 : 74.125
Is there a suitable string format that I can use, or do I need to test the last character of the string to see if it's a 0? This would work, I'm sure, but seems a little agricultural.
I know there are a lot of questions on here about the reverse, and I apologise if this is a duplicate question - I did try to search!