当前位置:网站首页>30 common tools (2)

30 common tools (2)

2020-12-07 16:08:59 Irving the procedural ape

Math Mathematical tools ( Method is a static method )

1 Rounding up ( Find a number larger than it recently ):ceil( The ceiling )

 System.out.println(Math.ceil(7.1)); // The return value is double type 

2 Rounding down ( Find the nearest number smaller than it ):floor( The floor )

 System.out.println(Math.floor(5.1)); // The return value is double type 

3 rounding :round

 System.out.print(Math.round(5.1)); System.out.print(Math.round(6.6)); // The return value is double type `

4 0-1 Random number between ( decimal ):random

 System.out.print(Math.ran.........

版权声明
本文为[Irving the procedural ape]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207160237235n.html