java.lang

Class Number

public abstract class Number extends Object implements Serializable

Number is a generic superclass of all the numeric classes, including the wrapper classes Byte, Short, Integer, Long, Float, and Double. Also worth mentioning are the classes in java.math. It provides ways to convert numeric objects to any primitive.

Since: 1.0

UNKNOWN: updated to 1.4

Constructor Summary
Number()
The basic constructor (often called implicitly).
Method Summary
bytebyteValue()
Return the value of this Number as a byte.
abstract doubledoubleValue()
Return the value of this Number as a float.
abstract floatfloatValue()
Return the value of this Number as a float.
abstract intintValue()
Return the value of this Number as an int.
abstract longlongValue()
Return the value of this Number as a long.
shortshortValue()
Return the value of this Number as a short.

Constructor Detail

Number

public Number()
The basic constructor (often called implicitly).

Method Detail

byteValue

public byte byteValue()
Return the value of this Number as a byte.

Returns: the byte value

Since: 1.1

doubleValue

public abstract double doubleValue()
Return the value of this Number as a float.

Returns: the double value

floatValue

public abstract float floatValue()
Return the value of this Number as a float.

Returns: the float value

intValue

public abstract int intValue()
Return the value of this Number as an int.

Returns: the int value

longValue

public abstract long longValue()
Return the value of this Number as a long.

Returns: the long value

shortValue

public short shortValue()
Return the value of this Number as a short.

Returns: the short value

Since: 1.1