public abstract class Number extends Object implements Serializable
Number
is the superclass of classes
BigDecimal
, BigInteger
,
Byte
, Double
, Float
,
Integer
, Long
, and Short
.
Subclasses of Number
must provide methods to convert
the represented numeric value to byte
, double
,
float
, int
, long
, and
short
.
Constructor and Description |
---|
Number() |
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
Returns the value of the specified number as a
byte . |
abstract double |
doubleValue()
Returns the value of the specified number as a
double . |
abstract float |
floatValue()
Returns the value of the specified number as a
float . |
abstract int |
intValue()
Returns the value of the specified number as an
int . |
abstract long |
longValue()
Returns the value of the specified number as a
long . |
short |
shortValue()
Returns the value of the specified number as a
short . |
public abstract int intValue()
int
.
This may involve rounding or truncation.int
.public abstract long longValue()
long
.
This may involve rounding or truncation.long
.public abstract float floatValue()
float
.
This may involve rounding.float
.public abstract double doubleValue()
double
.
This may involve rounding.double
.public byte byteValue()
byte
.
This may involve rounding or truncation.byte
.public short shortValue()
short
.
This may involve rounding or truncation.short
.