|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ge.research.utils.NumberUtils
Simple class to help with Numbers and primitive number representation.
| Constructor Summary | |
NumberUtils()
|
|
| Method Summary | |
static byte |
castToByte(double d)
Casts a double value to a byte value,
taking into account and eliminating overflow problems. |
static int |
castToInt(double d)
Casts a double value to a int value,
taking into account and eliminating overflow problems. |
static long |
castToLong(double d)
Casts a double value to a long value,
taking into account and eliminating overflow problems. |
static short |
castToShort(double d)
Casts a double value to a short value,
taking into account and eliminating overflow problems. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public NumberUtils()
| Method Detail |
public static short castToShort(double d)
double value to a short value,
taking into account and eliminating overflow problems.
d - the double to cast to a short
short.
If the argument double is smaller than the Short.MIN_VALUE then the Short.MIN_VALUE is returned.
If the argument double is larger than the Short.MAX_VALUE then the Short.MAX_VALUE is returned.public static byte castToByte(double d)
double value to a byte value,
taking into account and eliminating overflow problems.
d - the double to cast to a byte
byte.
If the argument double is smaller than the Byte.MIN_VALUE then the Byte.MIN_VALUE is returned.
If the argument double is larger than the Byte.MAX_VALUE then the Byte.MAX_VALUE is returned.public static long castToLong(double d)
double value to a long value,
taking into account and eliminating overflow problems.
d - the double to cast to a long
long.
If the argument double is smaller than the Long.MIN_VALUE then the Long.MIN_VALUE is returned.
If the argument double is larger than the Long.MAX_VALUE then the Long.MAX_VALUE is returned.public static int castToInt(double d)
double value to a int value,
taking into account and eliminating overflow problems.
d - the double to cast to a short
int.
If the argument double is smaller than the Integer.MIN_VALUE then the Int.MIN_VALUE is returned.
If the argument double is larger than the Integer.MAX_VALUE then the Int.MAX_VALUE is returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||