Number

The class {@code Number} is the superclass of platform classes representing numeric values that are convertible to the primitive types {@code byte}, {@code double}, {@code float}, {@code int}, {@code long}, and {@code short}.

The specific semantics of the conversion from the numeric value of a particular {@code Number} implementation to a given primitive type is defined by the {@code Number} implementation in question.

For platform classes, the conversion is often analogous to a narrowing primitive conversion or a widening primitive conversion as defined in <cite>The Java&trade; Language Specification</cite> for converting between primitive types. Therefore, conversions may lose information about the overall magnitude of a numeric value, may lose precision, and may even return a result of a different sign than the input.

See the documentation of a given {@code Number} implementation for conversion details.

@author Lee Boynton @author Arthur van Hoff @jls 5.1.2 Widening Primitive Conversions @jls 5.1.3 Narrowing Primitive Conversions

Members

Functions

byteValue
byte byteValue()

Returns the value of the specified number as a {@code byte}.

doubleValue
double doubleValue()

Returns the value of the specified number as a {@code double}.

floatValue
float floatValue()

Returns the value of the specified number as a {@code float}.

intValue
int intValue()

Returns the value of the specified number as an {@code int}.

longValue
long longValue()

Returns the value of the specified number as a {@code long}.

shortValue
short shortValue()

Returns the value of the specified number as a {@code short}.

toString
string toString()
Undocumented in source.

Meta