public class MathUtilities
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static byte |
clamp(byte value,
byte min,
byte max)
Modifies the value (if necessary) such that it lies within the boundaries of the specified minimum and maximum.
|
static double |
clamp(double value,
double min,
double max)
Modifies the value (if necessary) such that it lies within the boundaries of the specified minimum and maximum.
|
static float |
clamp(float value,
float min,
float max)
Modifies the value (if necessary) such that it lies within the boundaries of the specified minimum and maximum.
|
static int |
clamp(int value,
int min,
int max)
Modifies the value (if necessary) such that it lies within the boundaries of the specified minimum and maximum.
|
static long |
clamp(long value,
long min,
long max)
Modifies the value (if necessary) such that it lies within the boundaries of the specified minimum and maximum.
|
static short |
clamp(short value,
short min,
short max)
Modifies the value (if necessary) such that it lies within the boundaries of the specified minimum and maximum.
|
static boolean |
equals(double d1,
double d2,
double epsilon) |
static double |
getAverage(double[] numbers) |
static float |
getAverage(float[] numbers) |
static int |
getAverage(int[] numbers) |
static int |
getFullPercent(double value,
double fraction) |
static int |
getMax(int... numbers) |
static double |
getPercent(double value,
double fraction) |
static boolean |
isInt(double value) |
static boolean |
isOddNumber(int num) |
static double |
round(double value,
int places) |
static float |
round(float value,
int places) |
public static boolean equals(double d1, double d2, double epsilon)
public static float round(float value, int places)
public static double round(double value, int places)
public static double clamp(double value, double min, double max)
value
- The value to be clamped.min
- The minimum value to be accepted.max
- The maximum value to be accepted.public static float clamp(float value, float min, float max)
value
- The value to be clamped.min
- The minimum value to be accepted.max
- The maximum value to be accepted.public static byte clamp(byte value, byte min, byte max)
value
- The value to be clamped.min
- The minimum value to be accepted.max
- The maximum value to be accepted.public static short clamp(short value, short min, short max)
value
- The value to be clamped.min
- The minimum value to be accepted.max
- The maximum value to be accepted.public static int clamp(int value, int min, int max)
value
- The value to be clamped.min
- The minimum value to be accepted.max
- The maximum value to be accepted.public static long clamp(long value, long min, long max)
value
- The value to be clamped.min
- The minimum value to be accepted.max
- The maximum value to be accepted.public static double getAverage(double[] numbers)
public static float getAverage(float[] numbers)
public static int getAverage(int[] numbers)
public static int getMax(int... numbers)
public static boolean isInt(double value)
public static boolean isOddNumber(int num)
public static int getFullPercent(double value, double fraction)
public static double getPercent(double value, double fraction)