Package java.lang
Class Number
- java.lang.Object
-
- java.lang.Number
-
- All Implemented Interfaces:
Serializable
public abstract class Number extends Object implements Serializable
The abstract classNumberis the superclass of classesBigDecimal,BigInteger,Byte,Double,Float,Integer,Long, andShort.Subclasses of
Numbermust provide methods to convert the represented numeric value tobyte,double,float,int,long, andshort.
-
-
Constructor Summary
Constructors Constructor Description Number()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description bytebyteValue()Returns the value of the specified number as abyte.abstract doubledoubleValue()Returns the value of the specified number as adouble.abstract floatfloatValue()Returns the value of the specified number as afloat.abstract intintValue()Returns the value of the specified number as anint.abstract longlongValue()Returns the value of the specified number as along.shortshortValue()Returns the value of the specified number as ashort.
-
-
-
Method Detail
-
byteValue
public byte byteValue()
Returns the value of the specified number as abyte. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to type
byte.
-
doubleValue
public abstract double doubleValue()
Returns the value of the specified number as adouble. This may involve rounding.- Returns:
- the numeric value represented by this object after conversion to type
double.
-
floatValue
public abstract float floatValue()
Returns the value of the specified number as afloat. This may involve rounding.- Returns:
- the numeric value represented by this object after conversion to type
float.
-
intValue
public abstract int intValue()
Returns the value of the specified number as anint. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to type
int.
-
longValue
public abstract long longValue()
Returns the value of the specified number as along. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to type
long.
-
shortValue
public short shortValue()
Returns the value of the specified number as ashort. This may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to type
short.
-
-