- 浏览: 64738 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
xiangxm:
xurichusheng 写道一些涉及到密码保存的就需要加密/ ...
3DES加密 -
xurichusheng:
一些涉及到密码保存的就需要加密/解密了。不需要解密的密码,如登 ...
3DES加密
突然想起上次做题的时候我搞错了......我一直在误区中......于是写在这里警示一下。
其实许多大牛对于这个已经说了无数遍了,我就不多说了。
round()方法:
static long round(double a)
Returns the closest long to the argument.
static int round(float a)
Returns the closest int to the argument.
查看jdk文档,看看这几个方法到底是怎么回事。
ceil()和floor()方法:
基础很重要,有些东西不是相当然而,万丈高楼还的平地起!!
其实许多大牛对于这个已经说了无数遍了,我就不多说了。
round()方法:
static long round(double a)
Returns the closest long to the argument.
static int round(float a)
Returns the closest int to the argument.
查看jdk文档,看看这几个方法到底是怎么回事。
public static long round(double a) Returns the closest long to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long. In other words, the result is equal to the value of the expression: (long)Math.floor(a + 0.5d) Special cases: If the argument is NaN, the result is 0. If the argument is negative infinity or any value less than or equal to the value of Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE. If the argument is positive infinity or any value greater than or equal to the value of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE. public static int round(float a) Returns the closest int to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type int. In other words, the result is equal to the value of the expression: (int)Math.floor(a + 0.5f) Special cases: If the argument is NaN, the result is 0. If the argument is negative infinity or any value less than or equal to the value of Integer.MIN_VALUE, the result is equal to the value of Integer.MIN_VALUE. If the argument is positive infinity or any value greater than or equal to the value of Integer.MAX_VALUE, the result is equal to the value of Integer.MAX_VALUE.
ceil()和floor()方法:
public static double ceil(double a) Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer. Special cases: If the argument value is already equal to a mathematical integer, then the result is the same as the argument. If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument. If the argument value is less than zero but greater than -1.0, then the result is negative zero. Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x). public static double floor(double a) Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. Special cases: If the argument value is already equal to a mathematical integer, then the result is the same as the argument. If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
基础很重要,有些东西不是相当然而,万丈高楼还的平地起!!
发表评论
-
聊聊工作
2013-06-07 22:14 655最近比较忙,总有那么 ... -
点击屏幕其他地方动画消失
2013-05-29 22:05 2192功能需求描述: 自定义了一个控件,当触发按钮事件后动画移出来 ... -
回调函数
2013-05-17 23:22 863回调的使用在android 源码里面不少见: 这里截取了Vi ... -
ListView 使用实例。 类似于Fragment
2013-05-17 23:18 1071自定义适配器: // 自定义适配器 private c ... -
System.gc() in Java
2013-05-17 22:58 1228Java的的一个显著特点就是垃圾回收机制,关于垃圾回收机制 ... -
内部类
2013-05-05 17:33 0package com.xiangxm.javatest. ... -
解决could not create the java virtual machine问题(转)
2013-05-04 18:24 2067解决could not create the java vir ... -
以 2011-11-11 00:00:00 格式打印昨天的和明天的这个时候
2013-03-23 15:33 691之前遇到的面试题,重写一次。 package com.xi ... -
3DES加密
2013-03-23 14:01 1473package com.xiangxm.javatest. ... -
在MyEclipse中引入JDK源码(转)
2013-03-23 11:27 766源地址:在MyEclipse中引入JDK源码 很多朋友遇到过 ... -
java界面开发笔记
2013-03-14 17:03 0利用HTML显示多个Label JLabel label = ... -
eclipse java.lang.OutOfMemoryError: Java heap space 解决方案
2013-03-07 14:59 0可以在windows 更改系统环境变量加上JAVA_OPTS= ... -
URL的简单使用
2013-03-07 13:05 0URL的简单使用 /** * */ packa ... -
ClassLoader
2013-02-28 17:20 0ClassLoader一个经常出现又让很多人望而却步的词, ... -
Eclipse debug 使用(转)
2013-02-26 15:00 458Eclipse Debug不为人知的秘密 -
文件操作(delete files)
2013-02-24 12:15 1231package com.evangelsoft.cross ... -
MD5加密
2013-02-24 12:14 938package com.evangelsoft.cross ... -
Eclipse控制台中的中文输出乱码问题(转)
2013-02-22 17:43 566http://blog.sina.com.cn/s/blog_ ... -
解决中文乱码
2012-12-31 10:03 0荐于经常看到朋友说哪里出现中文乱码了,菜鸟我以自己在项目经 ... -
MyEclipse常用快捷键
2012-12-19 17:03 677红色部分为自己也经常用到的, (1)Ctrl+M切换窗口的大小 ...
相关推荐
主要介绍了Java Math.round(),Math.ceil(),Math.floor()的区别详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
首先还是看看[removed] The Definitive Guide, 4th Edition中对三个函数的定义。 Math.ceil(): round a number up ...Math.floor(): round a number down Arguments: Any numeric value or expressi
Math类取整方法和random随机值方法 Math类 Math类 1 掌握常用数学函数; 2 会使用Math类中的方法解决数学问题。 double ceil( double x) //返回一个大于等于 x的最小整数值 Math.ceil(2.1) 结果为 3.0 Math.ceil(2.0...
1.round函数(四舍五入) 描述 : 传回一个数值,该数值是按照指定的小数位元数进行四舍五入运算的结果 参数: number : 欲处理之数值 decimal_places : 四舍五入 , 小数取几位 ( 预设为 0 ) select round(123.456, ...
<SPAN xss=removed>1.Math... 2.Math.floor(num); 参数num为一个数值,函数结果为num的整数部分(返回小于等于n的最大整数)。 Math.floor(num); 参数num为一个数值,函数结果为num的整数部分(返回小于等于n的最大整数
js中Math之random,round,ceil,floor的用法总结.docx
Math方法使用: Math.ceil, Math.round, Math.floor
下面来介绍将小数值舍入为整数的几个方法:Math.ceil()、Math.floor()和Math.round()。 这三个方法分别遵循下列舍入规则: ◎Math.ceil()执行向上舍入,即它总是将数值向上舍入为最接近的整数; ◎Math.floor()执行...
【delphi_文章】delphi的取整函数round、trunc、ceil和floor.doc
# 1.35 Math.round(11.5)等於多少?...round 方法,它表示“四舍五入”,算法为 Math.floor(x+0.5),即将原来的数字加上0.5后再向 下取整,所以,Math.round(11.5)的结果为12,Math.round(-11.5)的结果为-11。
Math.ceil(Math.random()*10);...Math.floor(Math.random()*10); // 可均衡获取 0 到 9 的随机整数。Math.round(Math.random()*10); // 基本均衡获取 0 到 10 的随机整数,其中获取最小值 0 和最大值 10 的几率少一半。
axure函数速查表,包括TotalDragY DragTime Window.width Window.height Window.scrollX Window.scrollY PageName toExponential(decimalPoints) ...Math.floor(x) Math.log(x) Math.max(x,y) Math.min(x,y)
JavaScript Math.ceil 方法 ...提示:该方法与 Math.floor 方法正好相反。 Math.ceil 方法实例 [removed] [removed]( Math.ceil(0.35) + ); [removed]( Math.ceil(10) + ); [removed]( Math
Math.ceil(x) — 返回大于等于... ceil函数参数 x — 为number类型的数字 ceil函数返回值 返回大于等于x的最小整数 ceil函数示例 [removed](Math.ceil(5.99)); [removed](Math.ceil(-5.99)); [removed](Math.ceil(1.01)
...........................\.......\src\wyf\wpf\Ceil.java ...........................\.......\...\...\...\Constant.java ...........................\.......\...\...\...\Floor.java ....................
JavaScript Math.floor 方法 Math.floor 方法用于对数值向下取整,即得到小于或等于该数值的最大整数。语法如下: Math.floor(x) 参数说明: 参数 说明 x 必需。必须是一个数值。 提示:该方法与 Math.ceil ...
而Date的其他构造方法和普通方法的API都不容易实现国际化,因此目前Date类的大多数方法都被标识为过时,表示更灵活的时间类请参考java.util.Calendar。 Date的输出结果是按照国际通用格式输出的,而中国更习惯于...
python源码,math.py,math.nan acos acosh asin asinh atan atan2 ceil