Package it.unimi.dsi.fastutil
Class SafeMath
- java.lang.Object
-
- it.unimi.dsi.fastutil.SafeMath
-
public final class SafeMath extends java.lang.ObjectStatic utility method for safe conversions between primitive types.Note that the methods of this class will throw an exception whenever a larger type cannot be exactly represented by a smaller type. This includes doubles within the range a float, but with too many significant bits.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static floatsafeDoubleToFloat(double value)static bytesafeIntToByte(int value)static charsafeIntToChar(int value)static shortsafeIntToShort(int value)static bytesafeLongToByte(long value)static charsafeLongToChar(long value)static intsafeLongToInt(long value)static shortsafeLongToShort(long value)
-
-
-
Method Detail
-
safeIntToChar
public static char safeIntToChar(int value)
-
safeIntToByte
public static byte safeIntToByte(int value)
-
safeIntToShort
public static short safeIntToShort(int value)
-
safeLongToChar
public static char safeLongToChar(long value)
-
safeLongToByte
public static byte safeLongToByte(long value)
-
safeLongToShort
public static short safeLongToShort(long value)
-
safeLongToInt
public static int safeLongToInt(long value)
-
safeDoubleToFloat
public static float safeDoubleToFloat(double value)
-
-