Double longValue() in Java with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The longValue() method of Double class is a built in method to return the value specified by the calling object as long after type casting. Syntax DoubleObject.longValue() Parameters : It takes no parameters. Return type : It returns an long value i.e. the type casted value of the DoubleObject. Below is the implementation of the above method. Code 1 : Java // Java Code to implement // longValue() method of Double class class GFG { // Driver method public static void main(String[] args) { // creating a Double object Double d = new Double(1022); // longValue() method of Double class // typecast the value long output = d.longValue(); // printing the output System.out.println(output); } } Output 1022 Code 2 : Java // Java Code to implement // longValue() method of Double class class GFG { // Driver method public static void main(String[] args) { // creating a Double object Double d = new Double(-1023.23); // longValue() method of Double class // typecast the value long output = d.longValue(); // printing the output System.out.println(output); } } Output -1023 Comment More infoAdvertise with us Next Article Float longValue() in Java with Examples S ShivamKD Follow Improve Article Tags : Java Java-Library Java-lang package Practice Tags : Java Similar Reads DoubleAdder longValue() method in Java with Examples The java.DoubleAdder.longValue() is an inbuilt method in java that returns the sum() as a long after a narrowing primitive conversion. When the object of the class is created its initial value is zero. Syntax: public long longValue() Parameters:Return value: This method returns the numeric value rep 1 min read Byte longValue() method in Java with examples The longValue() method of Byte class is a built in method in Java which is used to return the value of this Byte object as long. Syntax ByteObject.longValue() Return Value: It return the value of ByteObject as long. Below is the implementation of longValue() method in Java: Example 1: Java // Java c 2 min read Double shortValue() method in Java with examples The shortValue() method of Double class is a built in method to return the value specified by the calling object as short after type casting.Syntax: DoubleObject.shortValue() Return Value: It return the value of DoubleObject as short.Below programs illustrate shortValue() method in Java: Program 1: 2 min read Float longValue() in Java with Examples The java.lang.Float.longValue() method in Float Class is a built in method in Java that returns the value specified by the calling object as long after type casting. Syntax: public long longValue() Parameters: It takes no parameters. Return type: It returns an long value i.e. the type casted value o 1 min read DoubleAccumulator longValue() method in Java with Examples The Java.DoubleAccumulator.longValue() is an inbuilt method in java that returns the current value as a long after a narrowing primitive conversion. It means the initial datatype is double which is explicitly converted into type long. Syntax: public long longValue() Parameters: The method does not a 2 min read LongAdder doubleValue() method in Java with Examples LongAdder class in Java creates a new adder with an initial sum of zero. The Java.LongAdder.doubleValue() is an inbuilt method in java that returns the sum as a double value. When the object of the class is created its initial value is zero. Syntax: public double doubleValue() Parameters: The functi 2 min read Like