Tuesday 12 March 2013

valueOf(String)


valueOf(String)

Declaration:
public static java.lang.Double valueOf(java.lang.String s)
throws NumberFormatException
Description:
Returns a new Double object initialized to the value represented by the specified string. The string s is
interpreted as the representation of a floating-point value and a Double object representing that value is
created and returned.
If s is null, then a NullPointerException is thrown.
Leading and trailing whitespace characters in s are ignored. The rest of s should constitute a FloatValue as
described by the lexical rule:
FloatValue:
Signopt FloatingPointLiteral
where Sign and FloatingPointLiteral are as defined in Section 3.10.2 of the Java Language Specification
(http://java.sun.com/docs/books/jls/html/). If it does not have the form of a FloatValue, then a
NumberFormatException is thrown. Otherwise, it is regarded as representing an exact decimal value
in the usual “computerized scientific notation”; this exact decimal value is then conceptually converted to
an “infinitely precise” binary value that is then rounded to type double by the usual round-to-nearest rule
of IEEE 754 floating-point arithmetic. Finally, a new object of class Double is created to represent the
double value.
Parameters:
s - the string to be parsed.
Returns: a newly constructed Double initialized to the value represented by the string argument.
Throws:
NumberFormatException - if the string does not contain a parsable number.
parseDouble(String)
Declaration:
public static double parseDouble(java.lang.String s)
throws NumberFormatException
Description:
Returns a new double initialized to the value represented by the specified String, as performed by the
valueOf method of class Double.
Parameters:
s - the string to be parsed.
Returns: the double value represented by the string argument.

isNaN(double)

Throws:
NumberFormatException - if the string does not contain a parsable double.
Since: JDK1.2
See Also: valueOf(String)
isNaN(double)
Declaration:
public static boolean isNaN(double v)
Description:
Returns true if the specified number is the special Not-a-Number (NaN) value.
Parameters:
v - the value to be tested.
Returns: true if the value of the argument is NaN; false otherwise.
isInfinite(double)
Declaration:
public static boolean isInfinite(double v)
Description:
Returns true if the specified number is infinitely large in magnitude.
Parameters:
v - the value to be tested.
Returns: true if the value of the argument is positive infinity or negative infinity; false otherwise.
isNaN()
Declaration:
public boolean isNaN()
Description:
Returns true if this Double value is the special Not-a-Number (NaN) value.
Returns: true if the value represented by this object is NaN; false otherwise.
isInfinite()
Declaration:
public boolean isInfinite()
Description:
Returns true if this Double value is infinitely large in magnitude.
Returns: true if the value represented by this object is positive infinity or negative infinity; false
otherwise.
toString()
Declaration:
public java.lang.String toString()

Description:
Returns a String representation of this Double object. The primitive double value represented by this
object is converted to a string exactly as if by the method toString of one argument.
Overrides: toString in class Object
Returns: a String representation of this object.
See Also: toString(double)
byteValue()
Declaration:
public byte byteValue()
Description:
Returns the value of this Double as a byte (by casting to a byte).
Since: JDK1.1
shortValue()
Declaration:
public short shortValue()
Description:
Returns the value of this Double as a short (by casting to a short).
Since: JDK1.1
intValue()
Declaration:
public int intValue()
Description:
Returns the integer value of this Double (by casting to an int).
Returns: the double value represented by this object is converted to type int and the result of the
conversion is returned.
longValue()
Declaration:
public long longValue()
Description:
Returns the long value of this Double (by casting to a long).
Returns: the double value represented by this object is converted to type long and the result of the
conversion is returned.
floatValue()
Declaration:
public float floatValue()
Description:
Returns the float value of this Double.


No comments:

Post a Comment