0
点赞
收藏
分享

微信扫一扫

10.java中数学和时间函数

乱世小白 2022-01-17 阅读 68

Math类
    Math.cbrt()//立方根
    Math.sqrt()//平方根
    Math.pow(x,y)//x的y次方
    Math.abs()//绝对值
    Math.max(x,y)//最大值
    Math.random()//0.0~1.0之间的随机值
    Math.round()//四舍五入后的值
    Math.sin()//正弦值


Date类
    new Date()//获得当前时间
    new Date().getHours()//获得当前小时
    new Date().getMinutes()//获得当前分钟
    new Date().getTime()//获得当前时间进度(毫秒为单位)

举报

相关推荐

0 条评论