int digit=1000;//10 取一位 100两位 1000三位 float num=(float)((int) (0.12345*digit))/digit;//先成1000取出三位,在除1000得到小数点后三位