📜  Java.lang.Double类

📅  最后修改于: 2020-11-15 02:59:56             🧑  作者: Mango


介绍

java.lang.Double类将原始类型double的值包装在一个对象中。类型为Double的对象包含单个类型为double的字段。

类声明

以下是java.lang.Double类的声明-

public final class Double
  extends Number
     implements Comparable

领域

以下是java.lang.Double类的字段-

  • static int MAX_EXPONENT-这是有限的double变量可能具有的最大指数。

  • 静态双MAX_VALUE -这是恒定保持double类型的最大正的有限值,(2-2- 52)×2 1023。

  • 静态整数MIN_EXPONENT-这是标准化双精度变量可能具有的最小指数。

  • 静态double MIN_NORMAL-这是一个常数,它保持double类型的最小正标准值2 -1022

  • 静态double MIN_VALUE-这是一个常量,它保持double类型的最小非零正值2 -1074

  • 静态双精度NaN-这是一个常量,它保存一个double型的非数值(NaN)值。

  • 静态double NEGATIVE_INFINITY-这是一个常数,保持double类型的负无穷大。

  • 静态双精度数POSITIVE_INFINITY-这是一个常量,它保持double型的正无穷大。

  • static int SIZE-这是用来表示双精度值的位数。

  • 静态Class TYPE-这是表示原始类型double的类实例

类的构造函数

Sr.No. Constructor & Description
1

Double(double value)

This constructs a newly allocated Double object that represents the primitive double argument.

2

Double(String s)

This constructs a newly allocated Double object that represents the floating-point value of type double represented by the string.

类方法

Sr.No. Method & Description
1 byte byteValue()

This method returns the value of this Double as a byte (by casting to a byte).

2 static int compare(double d1, double d2)

This method compares the two specified double values.

3 int compareTo(Double anotherDouble)

This method compares the two specified double values.

4 static long doubleToLongBits(double value)

This method returns a representation of the specified floating-point value according to the IEEE 754 floating-point “double format” bit layout.

5 static long doubleToRawLongBits(double value)

This method returns a representation of the specified floating-point value according to the IEEE 754 floating-point “double format” bit layout, preserving Not-a-Number (NaN) values.

6 double doubleValue()

This method returns a representation of the specified floating-point value according to the IEEE 754 floating-point “double format” bit layout, preserving Not-a-Number (NaN) values.

7 boolean equals(Object obj)

This method compares this object against the specified object.

8 float floatValue()

This method returns the float value of this Double object.

9 int hashCode()

This method returns a hash code for this Double object.

10 int intValue()

This method returns the value of this Double as an int (by casting to type int).

11 boolean isInfinite()

This method returns true if this Double value is infinitely large in magnitude, false otherwise.

12 static boolean isInfinite(double v)

This method returns true if the specified number is infinitely large in magnitude, false otherwise.

13 boolean isNaN()

This method returns true if this Double value is a Not-a-Number (NaN), false otherwise.

14 static boolean isNaN(double v)

This method returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

15 static double longBitsToDouble(long bits)

This method returns the double value corresponding to a given bit representation.

16 long longValue()

This method returns the value of this Double as a long (by casting to type long).

17 static double parseDouble(String s)

This method returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double.

18 short shortValue()

This method returns the value of this Double as a short (by casting to a short).

19 static String toHexString(double d)

This method returns a hexadecimal string representation of the double argument.

20 String toString()

This method returns a string representation of this Double object.

21 static String toString(double d)

This method returns a string representation of the double argument.

22 static Double valueOf(double d)

This method returns a Double instance representing the specified double value.

23 static Double valueOf(String s)

This method returns a Double object holding the double value represented by the argument string s.

方法继承

此类从以下类继承方法-

  • java.lang.Object