Math

不比真如一相会發表於2024-03-21

1.Math

1.1介紹

用於執行基本數字運算的工具類

1.2常用方法

1.2.1abs

public static int abs•(int a)//獲取引數的絕對值

1.2ceil和floor

public static double ceil•(double a)//向上取整

public static double floor•(double a)//向下取整

1.2.3round

public static int round•(float a)//四捨五入

1.2.4max和min

public static int max•(int a,int b)
public static int min•(int a,int b)

1.2.5pow

public static double pow(double a,double b)//a的b次冪

1.2.6random

public static double random•()//返回值為double的隨機值,範圍[0.0,1.0)