I need to format a decimal value into a string where I always display at lease 2 decimals and at most 4.
So for example
"34.49596" would be "34.4959"
"49.3" would be "49.30"
Can this be done using the String.format command?
Or is there an easier/better way to do this in Java.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…