Math
Arithmetic: absolute values, the larger or smaller of two numbers, rounding and more.
Final classJavaJava 11 docs
public final class MathExample
int gap = Math.abs(PlayerEx.getLocal().getWorldPoint().getX() - 3212);Members
Static methods
- intabs(int)
The value without its sign.
- longabs(long)
The value without its sign.
- intmax(int, int)
The larger of two numbers.
- longmax(long, long)
The larger of two numbers.
- intmin(int, int)
The smaller of two numbers.
- longmin(long, long)
The smaller of two numbers.
abs(int)static
public static int abs(int a)The value without its sign.
Parameters
a- A number.
Returns
a if it is zero or more, otherwise -a.
abs(long)static
public static long abs(long a)The value without its sign.
Parameters
a- A number.
Returns
a if it is zero or more, otherwise -a.
max(int, int)static
public static int max(int a, int b)The larger of two numbers.
Parameters
a- A number.
b- Another number.
Returns
The larger one.
max(long, long)static
public static long max(long a, long b)The larger of two numbers.
Parameters
a- A number.
b- Another number.
Returns
The larger one.
min(int, int)static
public static int min(int a, int b)The smaller of two numbers.
Parameters
a- A number.
b- Another number.
Returns
The smaller one.
min(long, long)static
public static long min(long a, long b)The smaller of two numbers.
Parameters
a- A number.
b- Another number.
Returns
The smaller one.
Also allowed
These work as in the Java 11 docs.
abs, acos, addExact, asin, atan, atan2, cbrt, ceil, copySign, cos, cosh, decrementExact, E, equals, exp, expm1, floor, floorDiv, floorMod, fma, getExponent, hashCode, hypot, IEEEremainder, incrementExact, log, log10, log1p, max, min, multiplyExact, multiplyFull, multiplyHigh, negateExact, nextAfter, nextDown, nextUp, PI, pow, random, rint, round, scalb, signum, sin, sinh, sqrt, subtractExact, tan, tanh, toDegrees, toIntExact, toRadians, toString, ulp