Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Number

public abstract class Number
extends Object implements Serializable

java.lang.Object
   ↳ java.lang.Number
Known Direct Subclasses


The abstract superclass of the classes which represent numeric base types (that is Byte, Short, Integer, Long, Float, and Double.

Summary

Public constructors

Number()

Empty default constructor.

Public methods

byte byteValue()

Returns this object's value as a byte.

abstract double doubleValue()

Returns this object's value as a double.

abstract float floatValue()

Returns this object's value as a float.

abstract int intValue()

Returns this object's value as an int.

abstract long longValue()

Returns this object's value as a long.

short shortValue()

Returns this object's value as a short.

Inherited methods

From class java.lang.Object

Public constructors

Number

Added in API level 1
Number ()

Empty default constructor.

Public methods

byteValue

Added in API level 1
byte byteValue ()

Returns this object's value as a byte. Might involve rounding and/or truncating the value, so it fits into a byte.

Returns
byte the primitive byte value of this object.

doubleValue

Added in API level 1
double doubleValue ()

Returns this object's value as a double. Might involve rounding.

Returns
double the primitive double value of this object.

floatValue

Added in API level 1
float floatValue ()

Returns this object's value as a float. Might involve rounding.

Returns
float the primitive float value of this object.

intValue

Added in API level 1
int intValue ()

Returns this object's value as an int. Might involve rounding and/or truncating the value, so it fits into an int.

Returns
int the primitive int value of this object.

longValue

Added in API level 1
long longValue ()

Returns this object's value as a long. Might involve rounding and/or truncating the value, so it fits into a long.

Returns
long the primitive long value of this object.

shortValue

Added in API level 1
short shortValue ()

Returns this object's value as a short. Might involve rounding and/or truncating the value, so it fits into a short.

Returns
short the primitive short value of this object.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.