Java DecimalFormat format decimal to String like "123456.789"
import java.text.DecimalFormat; public class Main { public static void main(String[] args) throws Exception { DecimalFormat myFormatter = new DecimalFormat("###.###"); String output = myFormatter.format(123456.789); System.out.println(output);/*from w w w. jav a2 s . c om*/ } }