I have a number with some number decimal places, How can i round this float number with one number decimal places
for example 1.366565646
convert to 1.3
In your case I think you need to trim the number not round it, You can use this:
double d = 1.366565646;
DecimalFormat df = new DecimalFormat("#.#");
double p = Double.parseDouble(df.format(d));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.