博客
关于我
Java中Math.round()方法的取整规则
阅读量:688 次
发布时间:2019-03-17

本文共 409 字,大约阅读时间需要 1 分钟。

just一句话:取最近的正数,当有两个最近的正数时,就取最大的那个!

举个例子:

public class Test {    public static void main(String[] args) {        System.out.println(Math.round(10.6));//11        System.out.println(Math.round(-10.6));//-11        System.out.println(Math.round(9.5));//10        System.out.println(Math.round(-9.5));//-9        System.out.println(Math.round(10.49));//10        System.out.println(Math.round(-10.49));//-10    }}

 

转载地址:http://jfvhz.baihongyu.com/

你可能感兴趣的文章
Node出错导致运行崩溃的解决方案
查看>>
Node响应中文时解决乱码问题
查看>>
node基础(二)_模块以及处理乱码问题
查看>>
node安装卸载linux,Linux运维知识之linux 卸载安装node npm
查看>>
node安装及配置之windows版
查看>>
Node实现小爬虫
查看>>
Node提示:error code Z_BUF_ERROR,error error -5,error zlib:unexpected end of file
查看>>
Node提示:npm does not support Node.js v12.16.3
查看>>
Node搭建静态资源服务器时后缀名与响应头映射关系的Json文件
查看>>
Node服务在断开SSH后停止运行解决方案(创建守护进程)
查看>>
node模块化
查看>>
node模块的本质
查看>>
node环境下使用import引入外部文件出错
查看>>
node环境:Error listen EADDRINUSE :::3000
查看>>
Node的Web应用框架Express的简介与搭建HelloWorld
查看>>
Node第一天
查看>>
node编译程序内存溢出
查看>>