floating point - Java: How to change Double 2.3 to "2.0"? -
how can alter
double d = 2.3 to
double value of 2.0 i used math.round, produces 2.0
i need save string 2.0
you can utilize printf(...):
system.out.printf("double value of %.1f", math.round(d)); or can save string using string.format(...):
string s = string.format("double value of %1f", math.round(d)); java floating-point double
No comments:
Post a Comment