import java.text.DecimalFormat; import java.math.RoundingMode; class Text{ public static void main(String args[]){ DecimalFormat formater = new DecimalFormat(); formater.setMaximumFractionDigits(2); formater.setGroupingSize(0); formater.setRoundingMode(RoundingMode.FLOOR); System.out.println(formater.format(123456.7897456)); } }
时间: 2024-10-01 10:55:55