DecimalFormat obj = new DecimalFormat(); obj.applyPattern(String); //将给定的模式应用于此对象 例子:"0.00" 小数后两位 System.out.println(obj.format(double/float));