package com.wf.dao;
public class A {
/**
* @param args
*/
public static void main(String[] args) {
// abs 取绝对值
System.out.println(Math.abs(-13));
// ceil天花板
System.out.println(Math.ceil(12.2)); // 13.0
System.out.println(Math.ceil(12.9)); // 13.0
// floor 地板
System.out.println(Math.floor(12.9)); // 12.0
System.out.println(Math.floor(12.1)); // 12.0
//pow() 2^10=1024
System.out.println(Math.pow(2, 10)); //1024.0
//生成0.0到1.0之间的所以小数,包括0.0,不包括1.0
System.out.println(Math.random());
//四舍五入
System.out.println(Math.round(12.9)); //13 返回类型是int类型
System.out.println(Math.round(12.1)); //12
//sqrt开平方
System.out.println(Math.sqrt(4)); //2.0
System.out.println(Math.sqrt(9)); //3.0
}
}
|
|