代码如下,后面的注释是输出的结果

public static void main(String[] args) {
System.out.println(Math.round(0.399));//
System.out.println(Math.round(0.4));//
System.out.println(Math.round(0.41));//
System.out.println(Math.round(0.499));//
System.out.println(Math.round(0.5));//
System.out.println(Math.round(0.51));//
System.out.println(Math.round(0.6));//
System.out.println("======================");
System.out.println(Math.round(-0.6));//-1
System.out.println(Math.round(-0.51));//-1
System.out.println(Math.round(-0.5));//
System.out.println(Math.round(-0.499));//
System.out.println(Math.round(-0.41));//
System.out.println(Math.round(-0.4));//
System.out.println(Math.round(-0.399));//
}

 总结,round的进位是向数轴的右方向进位的,而不是按照数的绝对值进行四舍五入的

关于Math对三角函数表示的一些知识点查看https://blog.csdn.net/River_Continent/article/details/80637952

最新文章

  1. 纯CSS3制作超级漂亮又实用的加载小图标
  2. PHPCMS 标签与示例
  3. NSDictionary(key与value)
  4. hdu 4927 java求组合数(大数)
  5. 使用Ant命令压缩JavaScript文件
  6. “DataTable”是“System.Data.DataTable”和“Microsoft.Office.Interop.Excel.DataTable”之间的不明确的引用
  7. 禁止Linux系统被 ping
  8. ASP.NET没有魔法——ASP.NET MVC 路由的匹配与处理
  9. 大数据学习系列之一 ----- Hadoop环境搭建(单机)
  10. Core Animation 文档翻译 (第五篇)
  11. Go语言切片
  12. 离线安装expect
  13. kali linux系统配置 避免踩坑
  14. django 使用 request 获取浏览器发送的参数
  15. 深拷贝数组 np.copy
  16. Gunicorn独角兽
  17. 使用zepto实现QQ消息左滑删除效果
  18. 【第二周】【作业五】Scrum 每日站会
  19. 洛谷 P2664 树上游戏 解题报告
  20. 禁止复制 + 锁右键 + 禁止全选(兼容IE Chrome等)

热门文章

  1. Maven中的依赖相关总结
  2. 'while' statement cannot complete without throwing an exception
  3. svg图片拖动与缩放
  4. python 排序 堆排序
  5. python 函数式编程 闭包,返回一个函数
  6. springmvc之静态资源访问不到 -记一次惨痛的经历
  7. FCC-学习笔记 DNA Pairing
  8. 【转载】Gradle学习 第三章:教程
  9. Android中webview html5 自动播放本地视频
  10. JavaWeb 发送邮件