Format it accordingly. For instance:
System.out.printf("%.1f", 1654621658874684.0);
Or you can use it as a String:
//"%.1f" this mean, how many number after the comma String value = String.format("%.1f", 1654621658874684.0);
Remember that double not infinitely accurate. It has an accuracy of about 15 to 17 decimal digits . If you want arbitrary precision floating point numbers, use BigDecimal instead of double .
source share