1) 将float 或Double直接转成int 或long时,会只取整数部分,如下:

  (int)(1.23)=1;

  (int)(1.99)=1;

  new Double(1.99).intValue()=1

2)若要四舍五入,使用Math.round().

posted on 2011-07-22 15:06  桃源月色  阅读(182)  评论(0编辑  收藏  举报