import java.text.DecimalFormat; public class Main { public static void main(String args[]) { double d = 123456.7890; DecimalFormat df = new DecimalFormat("#####0.00"); System.out.println(df.format(d)); } } //123456.79