Double class Methods in Java

java.lang.Double

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double. In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.

Some Methods of Double Class

Double.BYTESThe number of bytes used to represent a double value (i.e 8 is returned).


Double.compare(): It compares the two specified double values.


Double.doubleToLongBits() It returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.


Double.doubleToRawLongBits()It 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.


Double.hashCode()It returns a hash code for a double value.


Double.isFinite()It returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).


Double.isInfinite() It returns true if the specified number is infinitely large in magnitude, false otherwise.


Double.isNaN()It returns true if the specified number is Not-a-Number (NaN) value, false otherwise.


Double.longBitsToDouble()It returns the double value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point"double format" bit layout.


Double.max(): It returns the greater of two double values.


Double.MAX_EXPONENTMaximum exponent a finite double variable may have (i.e 1023).


Double.MAX_VALUEA constant holding the largest positive finite value of type double (i.e. 1.7976931348623157E308)


Double.min()It returns the smaller of two double values.


Double.MIN_EXPONENTMinimum exponent a normalized double variable may have (i.e. -1022)


Double.MIN_NORMAL A constant holding the smallest positive normal value of type double (i.e. 2.2250738585072014E-308)


Double.NaNA constant holding a Not-a-Number (NaN) value of type double.


Double.NEGATIVE_INFINITYA constant holding the negative infinity of type double.


Double.parseDouble()It returns a new double initialized to the value represented by the specified String.


Double.POSITIVE_INFINITYA constant holding the positive infinity of type double.


Double.SIZEThe number of bits is used to represent a double value (i.e. 64).


Double.sum()It adds two double values together as per the + operator.


Double.toHexString()It returns a hexadecimal string representation of the double argument.


Double.toString()It returns a string representation of the double argument.


Double.valueOf(double d): It returns a Double instance representing the specified double value.


Double.valueOf()It returns a Double-object holding the double value represented by the argument string s.


No comments:

Post a Comment