| java.lang.Object javolution.lang.MathLib
MathLib | final public class MathLib (Code) | | This utility class ensures cross-platform portability of the math
library. Functions not supported by the platform are emulated.
Developers may replace the current implementation with native
implementations for faster execution (unlike
java.lang.Math this class can be customized).
author: Jean-Marie Dautelle version: 4.2, January 6, 2007 |
Method Summary | |
public static int | abs(int i) Returns the absolute value of the specified int argument.
Parameters: i - the int value. | public static long | abs(long l) Returns the absolute value of the specified long argument.
Parameters: l - the long value. | public static int | bitLength(int i) Returns the number of bits in the minimal two's-complement representation
of the specified int , excluding a sign bit.
For positive int , this is equivalent to the number of bits
in the ordinary binary representation. | public static int | bitLength(long l) Returns the number of bits in the minimal two's-complement representation
of the specified long , excluding a sign bit.
For positive long , this is equivalent to the number of bits
in the ordinary binary representation. | public static int | digitLength(int i) Returns the number of digits in the minimal ten's-complement
representation of the specified int , excluding a sign bit.
For positive int , this is equivalent to the number of digit
in the ordinary decimal representation. | public static int | digitLength(long l) Returns the number of digits in the minimal ten's-complement
representation of the specified long , excluding a sign bit.
For positive long , this is equivalent to the number of digit
in the ordinary decimal representation. | public static int | max(int x, int y) Returns the greater of two int values. | public static long | max(long x, long y) Returns the greater of two long values. | public static int | min(int x, int y) Returns the smaller of two int values. | public static long | min(long x, long y) Returns the smaller of two long values. | public static int | random(int min, int max) Returns a pseudo random int value in the range
[min, max] (fast and thread-safe without synchronization).
Parameters: min - the minimum value inclusive. Parameters: max - the maximum value exclusive. | public static long | random(long min, long max) Returns a pseudo random long value in the range
[min, max] (fast and thread-safe without synchronization).
Parameters: min - the minimum value inclusive. Parameters: max - the maximum value inclusive. |
abs | public static int abs(int i)(Code) | | Returns the absolute value of the specified int argument.
Parameters: i - the int value. i or -i |
abs | public static long abs(long l)(Code) | | Returns the absolute value of the specified long argument.
Parameters: l - the long value. l or -l |
bitLength | public static int bitLength(int i)(Code) | | Returns the number of bits in the minimal two's-complement representation
of the specified int , excluding a sign bit.
For positive int , this is equivalent to the number of bits
in the ordinary binary representation. For negative int ,
it is equivalent to the number of bits of the positive value
-(i + 1) .
Parameters: i - the int value for which the bit length is returned. the bit length of i . |
bitLength | public static int bitLength(long l)(Code) | | Returns the number of bits in the minimal two's-complement representation
of the specified long , excluding a sign bit.
For positive long , this is equivalent to the number of bits
in the ordinary binary representation. For negative long ,
it is equivalent to the number of bits of the positive value
-(l + 1) .
Parameters: l - the long value for which the bit length is returned. the bit length of l . |
digitLength | public static int digitLength(int i)(Code) | | Returns the number of digits in the minimal ten's-complement
representation of the specified int , excluding a sign bit.
For positive int , this is equivalent to the number of digit
in the ordinary decimal representation. For negative int ,
it is equivalent to the number of digit of the positive value
-(i + 1) .
Parameters: i - the int value for which the digit length is returned. the digit length of i . |
digitLength | public static int digitLength(long l)(Code) | | Returns the number of digits in the minimal ten's-complement
representation of the specified long , excluding a sign bit.
For positive long , this is equivalent to the number of digit
in the ordinary decimal representation. For negative long ,
it is equivalent to the number of digit of the positive value
-(value + 1) .
Parameters: l - the long value for which the digit length is returned. the digit length of l . |
max | public static int max(int x, int y)(Code) | | Returns the greater of two int values.
Parameters: x - the first value. Parameters: y - the second value. the larger of x and y . |
max | public static long max(long x, long y)(Code) | | Returns the greater of two long values.
Parameters: x - the first value. Parameters: y - the second value. the larger of x and y . |
min | public static int min(int x, int y)(Code) | | Returns the smaller of two int values.
Parameters: x - the first value. Parameters: y - the second value. the smaller of x and y . |
min | public static long min(long x, long y)(Code) | | Returns the smaller of two long values.
Parameters: x - the first value. Parameters: y - the second value. the smaller of x and y . |
random | public static int random(int min, int max)(Code) | | Returns a pseudo random int value in the range
[min, max] (fast and thread-safe without synchronization).
Parameters: min - the minimum value inclusive. Parameters: max - the maximum value exclusive. a pseudo random number in the range [min, max] . |
random | public static long random(long min, long max)(Code) | | Returns a pseudo random long value in the range
[min, max] (fast and thread-safe without synchronization).
Parameters: min - the minimum value inclusive. Parameters: max - the maximum value inclusive. a pseudo random number in the range [min, max] . |
|
|