12.25 取值

//取绝对值
        System.out.println(Math.abs(-6.6));
        //向上取整
        System.out.println(Math.ceil(12.1));
        //向下取整
        System.out.println(Math.floor(12.9));
        //取两数最大值
        System.out.println(Math.max(12.1,12.9));
        //取两数最小值
        System.out.println(Math.min(12.1, 12.9));
        //次幂
        System.out.println(Math.pow(2, 10));
        //随机小数
        System.out.println(Math.random());
        //四舍五入
        System.out.println(Math.round(12.49999999999999999));

总结:这是取各种值的方式

posted @ 2019-12-25 14:53  坤坤坤  阅读(169)  评论(0)    收藏  举报