java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.math.MathUtil |
Set of common operations on Number that are not in Math.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MathUtil() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static double | avg(byte[] array) | ||||||||||
static double | avg(float[] array) | ||||||||||
static double | avg(short[] array) | ||||||||||
static double | avg(int[] array) | ||||||||||
static double | avg(long[] array) | ||||||||||
static double | avg(Collection<? extends Number> collection) | ||||||||||
static double | avg(double[] array) | ||||||||||
static double | avg(char[] array) | ||||||||||
static boolean |
betweenExclusive(long value, long min, long max)
Check that a value is between two bounds (exclusive)
| ||||||||||
static boolean |
betweenInclusive(long value, long min, long max)
Check that a value is between two bounds (inclusive)
| ||||||||||
static int |
minPositive(int... values)
Get the min of the values which is > 0.
| ||||||||||
static int |
moduloPositive(int a, int b)
Calculate the positive remainder of two integers.
| ||||||||||
static int |
pow(int a, int b)
Integer pow
| ||||||||||
static long | signExtend(long value, int bitsize) | ||||||||||
static long | signExtend(long value, int bitsize, int extendTo) | ||||||||||
static long | unmaskedArithShiftRight(long v, int cnt) | ||||||||||
static long | unmaskedShiftLeft(long v, int cnt) | ||||||||||
static long | unmaskedShiftRight(long v, int cnt) | ||||||||||
static long | zeroExtend(long value, int bitsize, int extendTo) | ||||||||||
static long | zeroExtend(long value, int bitsize) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Check that a value is between two bounds (exclusive)
value | value |
---|---|
min | min bound |
max | max bound |
Check that a value is between two bounds (inclusive)
value | value |
---|---|
min | min bound |
max | max bound |
Get the min of the values which is > 0. (for example when looking for min indexOf)
Calculate the positive remainder of two integers.
Note: Java standard modulo operators specifies that the remainder will have the sign of the numerator. This method provides an alternate way to calculate the remainder, often-time more useful, by making sure that it remains positive.
a | any integer |
---|---|
b | a strictly positive integer |
Integer pow