Math.round函数 向右看齐 2022-05-21 01:12 160阅读 0赞 Returns the closest {@code long} to the argument, with ties rounding to positive infinity. 返回一个最接近的值,如果是0.5,上下距离一样,向正无穷方向取值,其实就是取较大的值。 @Test public void testRound(){ System.out.println(Math.round(12.5)); //13 System.out.println(Math.round(-12.5)); //-12 System.out.println(Math.round(-12.6)); //-13 }
还没有评论,来说两句吧...