常用Math操作 rint round

2017-01-21 22:38:00
admin
原创 1490
摘要:常用Math操作 rint round

一、常用Math操作

double rint(double a) 返回最接近参数并且是整数的double
long round(double a) 返回最接近参数的long
int round(float a) 返回最接近参数的int


示例:

System.out.println(Math.rint(1.4)),输出1.0
System.out.println(Math.rint(1.6)),输出2.0

发表评论
评论通过审核之后才会显示。