public final class MathUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static double |
limit(double min,
double value,
double max)
Returns value limited by the specified range.
|
static float |
limit(float min,
float value,
float max)
Returns value limited by the specified range.
|
static int |
limit(int min,
int value,
int max)
Returns value limited by the specified range.
|
static long |
limit(long min,
long value,
long max)
Returns value limited by the specified range.
|
static int |
max(int... integers)
Returns maximum of the specified integer numbers.
|
static int |
min(int... integers)
Returns minimum of the specified integer numbers.
|
static int |
random()
Returns random integer number between 0 (inclusive) and 100 (inclusive).
|
static int |
random(int... numbers)
Returns random integer number from one the specified integers.
|
static int |
random(int cap)
Returns random integer number between 0 (inclusive) and cap (exclusive).
|
static int |
random(int min,
int max)
Returns random integer number between min (inclusive) and max (inclusive).
|
static int |
roundToInt(double d)
Returns double value rounded to int value.
|
static float |
sqr(float f)
Returns square for specified float number.
|
static int |
sqr(int i)
Returns square for specified integer number.
|
static int |
sqrtToInt(double d)
Returns rounded square root for the specified integer number.
|
public static int random()
public static int random(int cap)
cap - random numbers cappublic static int random(int min,
int max)
min - random numbers minimummax - random numbers maximumpublic static int random(@NotNull int... numbers)
numbers - number to choose random one frompublic static int sqr(int i)
i - integer number to processpublic static float sqr(float f)
f - float number to processpublic static int sqrtToInt(double d)
d - integer number to processpublic static int roundToInt(double d)
d - double value to roundpublic static int limit(int min,
int value,
int max)
min - range minimumvalue - value to limitmax - range maximumpublic static long limit(long min,
long value,
long max)
min - range minimumvalue - value to limitmax - range maximumpublic static float limit(float min,
float value,
float max)
min - range minimumvalue - value to limitmax - range maximumpublic static double limit(double min,
double value,
double max)
min - range minimumvalue - value to limitmax - range maximumpublic static int max(@NotNull int... integers)
integers - integer numbers to processpublic static int min(@NotNull int... integers)
integers - integer numbers to processCopyright © 2020. All rights reserved.