AtomicInteger intValue() method in Java with examples Last Updated : 29 Jan, 2019 Comments Improve Suggest changes Like Article Like Report 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 returns the current value. Program below demonstrates the function: Program 1: Java // Java program that demonstrates // the intValue() 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); int res = val.intValue(); // Prints the updated value System.out.println("Current value: " + res); } } Output: Current value: 0 Program 2: Java // Java program that demonstrates // the intValue() 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); int res = val.intValue(); // 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#intValue-- Comment More infoAdvertise with us Next Article AtomicInteger intValue() method in Java with examples gopaldave Follow Improve Article Tags : Java Java - util package Java-Functions Java-AtomicInteger Practice Tags : Java Similar Reads AtomicLong intValue() method in Java with examples The Java.util.concurrent.atomic.AtomicLong.intValue() is an inbuilt method in java that returns the value which is currently stored in the object which is of data-type long by doing a narrowing primitive conversion. Syntax: public long intValue() Parameters: The function does not accepts a single pa 1 min read AtomicInteger get() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.get() is an inbuilt method in java which returns the current value which is of date-type int. Syntax: public final int get() Parameters: The function does not accepts any parameter. Return value: The function returns the current value Program below demon 1 min read AtomicInteger floatValue() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.floatValue() is an inbuilt method in java which returns the current value of the AtomicInteger as a Float data-type after performing primitive conversion. Syntax: public float floatValue() Parameters: The function does not accepts any parameter. Return v 1 min read BigInteger intValueExact() Method in Java with Examples java.math.BigInteger.intValueExact() was introduced in Java 8. It is an inbuilt function which converts the value of BigInteger to a int and checks for lost information. If the value of BigInteger is greater than 2,147,483,647 or less than -2,147,483,648; the method will throw ArithmeticException as 3 min read AtomicInteger set() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.set() is an inbuilt method in java that updates the previous value and sets it to a new value which is passed in the parameter. Syntax: public final void set(int newVal) Parameters: The function accepts a single mandatory parameter newVal which is to be 1 min read Byte intValue() method in Java with examples The intValue() method of Byte class is a built in method in Java which is used to return the value of this Byte object as int. Syntax ByteObject.intValue() Return Value: It returns the value of ByteObject as int. Below is the implementation of intValue() method in Java: Example 1: Java // Java code 2 min read AtomicInteger getAndAdd() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.getAndAdd() is an inbuilt method in java that adds the given value to the current value and returns the value before updation which is of data-type int. Syntax: public final int getAndAdd(int val) Parameters: The function accepts a single mandatory param 2 min read AtomicInteger getAndSet() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.getAndSet() is an inbuilt method in java that sets the given value to the value passed in the parameter and returns the value before updation which is of data-type int. Syntax: public final int getAndSet(int val) Parameters: The function accepts a single 2 min read AtomicInteger longValue() method in Java with examples 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 sin 1 min read DoubleAdder intValue() method in Java with Examples The java.DoubleAdder.intValue() is an inbuilt method in java that returns the sum() as an int after a narrowing primitive conversion. When the object of the class is created its initial value is zero. Syntax: public int intValue() Parameters: This method does not accepts any parameter. Return Value: 1 min read Like