java.lang.Math中的常用方法

java.lang.Math中的方法都是静态方法。

返回正平方根
public static double sqrt(double a)
返回正立方根
public static double cbrt(double a)
返回a的b次方
public static double pow(double a, double b)
返回[0,1)伪随机double值
public static double random()
返回绝对值
public static int abs(int a)
public static long abs(long a)
public static float abs(float a)
public static double abs(double a)
返回较大值
public static int max(int a, int b)
public static long max(long a, long b)
public static float max(float a, float b)
public static double max(double a, double b)
返回较小值
public static int min(int a, int b)
public static long min(long a, long b)
public static float min(float a, float b)
public static double min(double a, double b)
向上取整
public static double ceil(double a)
向下取整
public static double floor(double a)
返回最接近参数的整数,同等接近,偶数优先返回。
public static double rint(double a)
返回四舍五入的整数。
public static int round(float a)
原文地址:https://www.cnblogs.com/shijianchuzhenzhi/p/13058917.html