| 1234567891011121314151617181920212223 |
- package course.api.math;
- /**
- * @author WanJl
- * @version 1.0
- * @title MathTest
- * @description
- * @create 2026/7/27
- */
- public class MathTest {
- public static void main(String[] args) {
- System.out.println("π:"+Math.PI);
- System.out.println("获取绝对值:"+Math.abs(-6));
- System.out.println("获取最大值:"+Math.max(15,7));
- System.out.println("获取最小值:"+Math.min(15,7));
- System.out.println("2的10次方:"+Math.pow(2,10));
- System.out.println("开根号:"+Math.sqrt(16));
- System.out.println("向上取整:"+Math.ceil(3.2));
- System.out.println("向下取整:"+Math.floor(3.2));
- System.out.println("四舍五入:"+Math.round(3.6));
- System.out.println("[0.0 , 1.0]随机数:"+Math.random());
- }
- }
|