Set format to two decimal places: set Minimum Fraction Digits
import java.text.NumberFormat; public class Main { public static void main(String[] argv) throws Exception { NumberFormat nf = NumberFormat.getInstance(); nf.setMinimumFractionDigits(2); System.out.println("Format with two decimal places: " + nf.format(1234567.678)); } }