/*
* Copyright (c) 1994, 2001, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.lang;
/**
* The abstract class Number
is the superclass of classes
* BigDecimal
, 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
, and
* short
.
*
* @author Lee Boynton
* @author Arthur van Hoff
* @see java.lang.Byte
* @see java.lang.Double
* @see java.lang.Float
* @see java.lang.Integer
* @see java.lang.Long
* @see java.lang.Short
* @since JDK1.0
*/
public abstract class Number implements java.io.Serializable {
/**
* Returns the value of the specified number as an int
.
* This may involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion
* to type int
.
*/
public abstract int intValue();
/**
* Returns the value of the specified number as a long
.
* This may involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion
* to type long
.
*/
public abstract long longValue();
/**
* Returns the value of the specified number as a float
.
* This may involve rounding.
*
* @return the numeric value represented by this object after conversion
* to type float
.
*/
public abstract float floatValue();
/**
* Returns the value of the specified number as a double
.
* This may involve rounding.
*
* @return the numeric value represented by this object after conversion
* to type double
.
*/
public abstract double doubleValue();
/**
* Returns the value of the specified number as a byte
.
* This may involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion
* to type byte
.
* @since JDK1.1
*/
public byte byteValue() {
return (byte)intValue();
}
/**
* Returns the value of the specified number as a short
.
* This may involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion
* to type short
.
* @since JDK1.1
*/
public short shortValue() {
return (short)intValue();
}
/** use serialVersionUID from JDK 1.0.2 for interoperability */
private static final long serialVersionUID = -8742448824652078965L;
}