public final class Double extends Number
Modifier and Type | Field and Description |
---|---|
static double |
MAX_VALUE
MAX_VALUE
|
static double |
MIN_VALUE
MIN_VALUE
|
static double |
NaN
NaN
|
static double |
NEGATIVE_INFINITY
NEGATIVE_INFINITY
|
static double |
POSITIVE_INFINITY
POSITIVE_INFINITY
|
static Class |
TYPE
TYPE Primitive class type for double
|
Constructor and Description |
---|
Double(double dbl)
Instantiates a Double object with the provided double value.
|
Double(String str)
Instantiates a Double object with a value parsed from a string.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
Returns the byte value.
|
static long |
doubleToLongBits(double dblval)
Returns a long value containing the bit pattern matching the supplied double value.
|
double |
doubleValue()
Returns the double value associated with this object.
|
boolean |
equals(Object obj)
Compares two Objects for equality.
|
float |
floatValue() |
int |
hashCode()
Returns a hash code value for the object.
|
int |
intValue() |
boolean |
isInfinite()
Determines if the double value associated with this object is the IEEE 754 representation of Infinity.
|
static boolean |
isInfinite(double dbl)
Determines if the supplied double value is the IEEE 754 representation of Infinity.
|
boolean |
isNaN()
Determine is the double value associated with this object is a valid IEEE 754 value.
|
static boolean |
isNaN(double dbl)
Determine if the supplied double value is a valid IEEE 754 value.
|
static double |
longBitsToDouble(long lval)
Returns a double value containing the bit pattern matching the supplied long value.
|
long |
longValue()
Returns the double value rounded to the nearest integer as a long value.
|
short |
shortValue()
Returns the double value rounded to the nearest integer as a short value.
|
String |
toString()
Returns the string representation of the double value associated with this object.
|
static String |
toString(double dval)
returns the String representation of a double value.
|
static Double |
valueOf(double dbl)
Returns a Double object whose double value is as supplied.
|
static Double |
valueOf(String str)
Returns a Double object whose double value is represented by the supplied string.
|
public static final double POSITIVE_INFINITY
public static final double NEGATIVE_INFINITY
public static final double NaN
public static final double MAX_VALUE
public static final double MIN_VALUE
public static final Class TYPE
public Double(double dbl)
dbl
- value for the objectpublic Double(String str) throws NumberFormatException
str
- Character representation of a numeric valueNumberFormatException
- if the string cannot be parsedpublic byte byteValue()
public static long doubleToLongBits(double dblval)
dblval
- supplied double valuepublic double doubleValue()
doubleValue
in class Number
public boolean equals(Object obj)
Object
The equals
method implements an equivalence relation:
x
,
x.equals(x)
should return true
.
x
and
y
, x.equals(y)
should return
true
if and only if y.equals(x)
returns
true
.
x
,
y
, and z
, if x.equals(y)
returns true
and y.equals(z)
returns
true
, then x.equals(z)
should return
true
.
x
and y
, multiple invocations of x.equals(y)
consistently return true
or consistently return
false
.
x
, x.equals(null)
should return false
.
The equals method for class Object
implements the most
discriminating possible equivalence relation on objects; that is,
for any reference values x
and y
, this
method returns true
if and only if x
and
y
refer to the same object (x==y
has the
value true
).
equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Boolean.hashCode()
,
Hashtable
public float floatValue()
floatValue
in class Number
public int hashCode()
Object
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer. This integer need not
remain consistent from one execution of an application to another
execution of the same application.
equals
method, then calling the hashCode
method on each of the
two objects must produce the same integer result.
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
public boolean isInfinite()
public static boolean isInfinite(double dbl)
dbl
- double valuepublic boolean isNaN()
public static boolean isNaN(double dbl)
dbl
- double valuepublic static double longBitsToDouble(long lval)
lval
- long valuepublic long longValue()
public short shortValue()
shortValue
in class Number
public String toString()
public static String toString(double dval)
dval
- double valuepublic static Double valueOf(String str) throws NumberFormatException
str
- numeric string representationNumberFormatException
- if the string cannot be parsed into a valuepublic static Double valueOf(double dbl)
dbl
- double value