Class NumberUtil
Defines a helper class to work with numbers
Inherited Members
Namespace:
Assembly: .dll
Syntax
public class NumberUtil
Constructors
NumberUtil()
Declaration
public NumberUtil()
Methods
constrain(double value, double lowerBound, double upperBound)
Constrains the value to specified bounds
Declaration
public static double constrain(double value, double lowerBound, double upperBound)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to constrain |
| double | lowerBound | The lover bound |
| double | upperBound | The upper bounds |
Returns
| Type | Description |
|---|---|
| double | The constrained value |
constrain(float value, float lowerBound, float upperBound)
Constrains the value to specified bounds
Declaration
public static float constrain(float value, float lowerBound, float upperBound)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The value to constrain |
| float | lowerBound | The lover bound |
| float | upperBound | The upper bounds |
Returns
| Type | Description |
|---|---|
| float | The constrained value |
constrain(int value, int lowerBound, int upperBound)
Constrains the value to specified bounds
Declaration
public static int constrain(int value, int lowerBound, int upperBound)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The value to constrain |
| int | lowerBound | The lover bound |
| int | upperBound | The upper bounds |
Returns
| Type | Description |
|---|---|
| int | The constrained value |
constrain(long value, long lowerBound, long upperBound)
Constrains the value to specified bounds
Declaration
public static long constrain(long value, long lowerBound, long upperBound)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value | The value to constrain |
| long | lowerBound | The lover bound |
| long | upperBound | The upper bounds |
Returns
| Type | Description |
|---|---|
| long | The constrained value |
isIntegerType(Class<?> type)
Checks whether the specified type is an integer type
Declaration
public static boolean isIntegerType(Class<?> type)
Parameters
| Type | Name | Description |
|---|---|---|
| Class<?> | type | Type to check |
Returns
| Type | Description |
|---|---|
| boolean | True is type is integer type |