Java Double longValue() Method10 Nov 2024 | 2 min read The longValue() method of Java Double class returns the value of this object as a long after narrowing the primitive values or by casting to type long. SyntaxParametersNA Return valueThe longValue() method returns the double value corresponding to this Double which has been converted to type long. Example 1Output: 1. Long value for 655.0 = 655 2. Long value for 6.575876985679675E12 = 6575876985679 3. Long value for -8.677698567988675E10 = -86776985679 Example 2Output: Enter three numbers 1.56.7568 2.422.087775 3.0.456454 1.Sum: 56+422+0 = 478 1.Mul: 56*422*0 = 0 Example 3Output: Enter your annual income 486674.4553 You got an increment of 5000. Your new monthly salary is:45556 Next TopicJava-double-max-method |
Java Double.compareTo() Method The compareTo() method of Double class compares two double values numerically. Syntax public int compareTo(Double anotherDouble) Parameters anotherDouble - the Double value to be compared Return value This method returns the value- Zero, if anotherDouble has same value as this Double. Positive value, if anotherDouble has a greater...
2 min read
The doubleToRawLongBits() method of Double class returns a floating-point value according to the IEEE 754 floating-point "double format" bit layout, preserving Not-a-Number(NaN) values. Syntax public static long doubleToRawLongBits(double value) Parameters Value is the double parameter passed which is a double precision floating-point number. Return value The doubleToLongBits(double value) method...
3 min read
The floatValue() method of Double class returns a float value of this double object. Syntax public float floatValue() Parameters NA Return value The floatValue() method returns the double value converted to type float . Example 1 public class Double_floatValueMethodExample1 { public static void main(String[] args) { ...
2 min read
The Double class generally wraps the primitive type double into an object. An object of Double class contains a field with the type Double. Methods: This class is useful in providing various methods like a method which can be used to convert a double to a String and...
3 min read
The parseDouble method of Java Double class returns a new double value that is initialized to the value corresponding to defined String. This method executes same as valueOf() method of Float class. Syntax public static double parseDouble(String s) throws NumberFormatException Parameters s- This is the string to be parsed. Return value The parseDouble()...
3 min read
The hashCode() method of Java Double class returns the hash code for this Double. The result is obtained by performing exclusive OR operation on two halves of the long integer bit representation which is same as produced by the doubleToLongBits() method. Overrides The hashCode() method of class...
3 min read
The isNaN() method of Java Double class returns true: If the value of this Object is Not-a-Number (NaN). If the argument passed is Not-a-Number (NaN). Otherwise, the method returns false. Syntax 1.public boolean isNaN() 2.public static boolean isNaN(double v) Parameters 1.NA 2.' v ' is the double value to be tested. Return value The isNaN() method returns...
3 min read
The longBitsToDouble() method of Java Double class returns the double value equating to an acknowledged bit representation. The result is: Positive infinity, if the argument passed is 0x7ff0000000000000L. Negative infinity, if the argument passed is 0x7ff0000000000000L. Syntax public static double longBitsToDouble(long bits) Parameters bits - is the long integer passed. Return value The...
3 min read
The isInfinite() method of Java Double class will return true if the magnitude of the argument specified is infinitely large, else it will return false. Syntax 1.public boolean isInfinite() 2.public static boolean isInfinite(double v) Parameters 1.NA 2.v- This is the double value which is tested. Return value The isInfnite() method returns true if the...
3 min read
The doubleToLongBits() method of Java Double class returns a floating-point value according to the IEEE 754 floating-point "double format" bit layout. Syntax public static long doubleToLongBits(double value) Parameters Value is the double parameter passed which is a double precision floating-point number. Return value The doubleToLongBits(double value) method returns the bits...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India