Format a number with DecimalFormat
import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { public static void main(String[] args) { double money = 123456789.12; NumberFormat formatter = new DecimalFormat("#0.00"); System.out.println(money); System.out.println(formatter.format(money)); } }