Interface INumber

All Known Subinterfaces:
IMutableInteger<IMPLTYPE>, IMutableNumeric<IMPLTYPE>
All Known Implementing Classes:
AbstractMutableInteger, AbstractMutableNumeric, MutableBigDecimal, MutableBigInteger, MutableByte, MutableChar, MutableDouble, MutableFloat, MutableInt, MutableLong, MutableShort

public interface INumber
Base interface comparable to Number - but an interface and not an abstract class.
Author:
Philip Helger
  • Method Summary

    Modifier and Type
    Method
    Description
    default byte
    Returns the value of the specified number as a byte, which may involve rounding or truncation.
    double
    Returns the value of the specified number as a double, which may involve rounding.
    float
    Returns the value of the specified number as a float, which may involve rounding.
    int
    Returns the value of the specified number as an int, which may involve rounding or truncation.
    long
    Returns the value of the specified number as a long, which may involve rounding or truncation.
    default short
    Returns the value of the specified number as a short, which may involve rounding or truncation.
  • Method Details

    • intValue

      int intValue()
      Returns the value of the specified number as an int, which may involve rounding or truncation.
      Returns:
      the numeric value represented by this object after conversion to type int.
    • longValue

      long longValue()
      Returns the value of the specified number as a long, which may involve rounding or truncation.
      Returns:
      the numeric value represented by this object after conversion to type long.
    • floatValue

      float floatValue()
      Returns the value of the specified number as a float, which may involve rounding.
      Returns:
      the numeric value represented by this object after conversion to type float.
    • doubleValue

      double doubleValue()
      Returns the value of the specified number as a double, which may involve rounding.
      Returns:
      the numeric value represented by this object after conversion to type double.
    • byteValue

      default byte byteValue()
      Returns the value of the specified number as a byte, which may involve rounding or truncation.

      This implementation returns the result of intValue() cast to a byte.

      Returns:
      the numeric value represented by this object after conversion to type byte.
    • shortValue

      default short shortValue()
      Returns the value of the specified number as a short, which may involve rounding or truncation.

      This implementation returns the result of intValue() cast to a short.

      Returns:
      the numeric value represented by this object after conversion to type short.