AtomicInteger longValue() method in Java with examples Last Updated : 29 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The java.util.concurrent.atomic.AtomicInteger.longValue() is an inbuilt method in java that returns the value which is currently stored in the object by converting it into a long data-type which is a primitive conversion. Syntax: public int longValue() Parameters: The function does not accepts a single parameter. Return value: The function returns the current value in Long data-type. Program below demonstrates the function: Program 1: Java // Java program that demonstrates // the longValue() function import java.util.concurrent.atomic.AtomicInteger; public class GFG { public static void main(String args[]) { // Initially value as 0 AtomicInteger val = new AtomicInteger(0); long res = val.longValue(); // Prints the updated value System.out.println("Current value: " + res); } } Output: Current value: 0 Program 2: Java // Java program that demonstrates // the longValue() function import java.util.concurrent.atomic.AtomicInteger; public class GFG { public static void main(String args[]) { // Initially value as 18 AtomicInteger val = new AtomicInteger(18); long res = val.longValue(); // Prints the updated value System.out.println("Current value: " + res); } } Output: Current value: 18 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html#longValue-- Comment More infoAdvertise with us Next Article AtomicInteger longValue() method in Java with examples G gopaldave Follow Improve Article Tags : Java Java - util package Java-Functions Java-AtomicInteger Practice Tags : Java Similar Reads AtomicLong longValue() method in Java with examples The Java.util.concurrent.atomic.AtomicLong.longValue() is an inbuilt method in java that returns the value which is currently stored in the object and its data-type is long. Syntax: public long longValue() Parameters: The function does not accepts a single parameter. Return value: The function retur 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 AtomicInteger intValue() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.intValue() is an inbuilt method in java that returns the value which is currently stored in the object which is of data-type int. Syntax: public int intValue() Parameters: The function does not accepts a single parameter. Return value: The function retur 1 min read 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 Java 8 | BigInteger longValueExact() Method with Examples java.math.BigInteger.longValueExact() was introduced in Java 8. It is an inbuilt function which converts the value of BigInteger to a long and checks for lost information. If the value of BigInteger is greater than 9,223,372,036,854,775,807 or less than -9,223,372,036,854,775,808; the method will th 3 min read Like