Class NumberUtils
java.lang.Object
net.darkhax.pricklemc.common.api.util.NumberUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalasBigDecimal(Number number) Gets a BigDecimal representation of a number.static intcompareNumber(Number x, Number y) Compares two numbers as a comparator.static booleanChecks if number x is equal to number y.static booleangreaterThan(Number x, Number y) Checks if number x is greater than number y.static booleanisSpecialNumber(Number number) Checks if a number requires special handling.static booleanChecks if number x is less than number y.
-
Constructor Details
-
NumberUtils
public NumberUtils()
-
-
Method Details
-
greaterThan
Checks if number x is greater than number y.- Parameters:
x- The first number.y- The second number.- Returns:
- If x is greater than y.
-
equals
Checks if number x is equal to number y.- Parameters:
x- The first number.y- The second number.- Returns:
- If x is equal to y.
-
lessThan
Checks if number x is less than number y.- Parameters:
x- The first number.y- The second number.- Returns:
- If x is less than y.
-
compareNumber
Compares two numbers as a comparator.- Parameters:
x- The first number.y- The second number.- Returns:
- The results of the comparison.
-
isSpecialNumber
Checks if a number requires special handling. For example NaN and infinity.- Parameters:
number- The number to test.- Returns:
- If the number requires special handling.
-
asBigDecimal
Gets a BigDecimal representation of a number. This can be useful when comparing two numbers.- Parameters:
number- The number to represent.- Returns:
- A BigDecimal representation of the number.
-