public abstract class Number extends Object implements Serializable
Number是表示数字值可转换为基本数据类型平台类的超类byte , double , float , int , long和short 。
从一个特定的数字值转换的特定语义Number实现给定的原语类型由定义Number所讨论的实现。
对于平台类,转换往往是类似于一个基本收缩转换或加宽原语转换为The Java™ Language Specification限定用于原始类型之间的转换。
因此,转换可能会丢失有关数值的总体大小的信息,可能会失去精度,甚至可能会返回与输入不同的符号结果。
有关转换的详细信息,请参阅给定的Number实现的文档。
| Constructor and Description |
|---|
Number() |
| Modifier and Type | Method and Description |
|---|---|
byte |
byteValue()
返回指定号码作为值
byte ,这可能涉及舍入或截断。
|
abstract double |
doubleValue()
返回指定数字的值为
double ,可能涉及四舍五入。
|
abstract float |
floatValue()
返回指定数字的值为
float ,可能涉及四舍五入。
|
abstract int |
intValue()
返回指定号码作为值
int ,这可能涉及舍入或截断。
|
abstract long |
longValue()
返回指定数字的值为
long ,可能涉及四舍五入或截断。
|
short |
shortValue()
返回指定号码作为值
short ,这可能涉及舍入或截断。
|
public abstract int intValue()
int ,可能涉及四舍五入或截断。
int之后表示的
int 。
public abstract long longValue()
long ,可能涉及四舍五入或截断。
long之后表示的
long 。
public abstract float floatValue()
float ,这可能涉及舍入。
float之后表示的
float 。
public abstract double doubleValue()
double ,可能涉及四舍五入。
double之后表示的
double 。
public byte byteValue()
byte ,可能涉及四舍五入或截断。
此实现返回intValue()转换为byte的结果。
byte之后表示的
byte 。
public short shortValue()
short ,这可能涉及四舍五入或截断。
此实现返回intValue()转换为short的结果。
short之后表示的
short 。
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, 2014, Oracle and/or its affiliates. All rights reserved.