Number (Java Platform SE 7 ) (original) (raw)
- java.lang.Number
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AtomicInteger, AtomicLong, BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, Short
public abstract class Number
extends Object
implements Serializable
The abstract class Number
is the superclass of classesBigDecimal
, 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
, andshort
.
Since:
JDK1.0
See Also:
Byte, Double, Float, Integer, Long, Short, Serialized Form
Constructor Summary
Constructors
Constructor and Description Number() Method Summary
Methods
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. * ### Methods inherited from class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone%28%29), [equals](../../java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../java/lang/Object.html#finalize%28%29), [getClass](../../java/lang/Object.html#getClass%28%29), [hashCode](../../java/lang/Object.html#hashCode%28%29), [notify](../../java/lang/Object.html#notify%28%29), [notifyAll](../../java/lang/Object.html#notifyAll%28%29), [toString](../../java/lang/Object.html#toString%28%29), [wait](../../java/lang/Object.html#wait%28%29), [wait](../../java/lang/Object.html#wait%28long%29), [wait](../../java/lang/Object.html#wait%28long,%20int%29)`
Constructor Detail
* #### Number public Number()
Method Detail
* #### intValue public abstract int intValue() Returns the value of the specified number as an `int`. 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 a `long`. This may involve rounding or truncation. Returns: the numeric value represented by this object after conversion to type `long`. * #### floatValue public abstract float floatValue() Returns the value of the specified number as a `float`. This may involve rounding. Returns: the numeric value represented by this object after conversion to type `float`. * #### doubleValue public abstract double doubleValue() Returns the value of the specified number as a `double`. This may involve rounding. Returns: the numeric value represented by this object after conversion to type `double`. * #### byteValue public byte byteValue() Returns the value of the specified number as a `byte`. This may involve rounding or truncation. Returns: the numeric value represented by this object after conversion to type `byte`. Since: JDK1.1 * #### shortValue public short shortValue() Returns the value of the specified number as a `short`. This may involve rounding or truncation. Returns: the numeric value represented by this object after conversion to type `short`. Since: JDK1.1
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.