AtomicIntegerArray get() method in Java with Examples Last Updated : 27 Feb, 2019 Comments Improve Suggest changes Like Article Like Report The Java.util.concurrent.atomic.AtomicIntegerArray.get() is an inbuilt method in java that gets the current value at any position of the AtomicIntegerArray. This method takes the index value as the parameter and returns the value at this index. Syntax: public final int get(int i) Parameters: The function accepts a single parameter i i.e the value of index to get. Return value: The function returns the current value at index i. Below programs illustrate the above method: Program 1: Java // Java program that demonstrates // the get() function import java.util.concurrent.atomic.AtomicIntegerArray; public class GFG { public static void main(String args[]) { // Initializing an array int a[] = { 1, 2, 3, 4, 5 }; // Initializing an AtomicIntegerArray with array a AtomicIntegerArray arr = new AtomicIntegerArray(a); // Displaying the AtomicIntegerArray System.out.println("The array : " + arr); // Index to get int idx = 2; // Using get() to retrieve value at idx int val = arr.get(idx); // Displaying the value at idx System.out.println("Value at index " + idx + " is " + val); } } Output: The array : [1, 2, 3, 4, 5] Value at index 2 is 3 Program 2: Java // Java program that demonstrates // the get() function import java.util.concurrent.atomic.AtomicIntegerArray; public class GFG { public static void main(String args[]) { // Initializing an array int a[] = { 12, 22, 23, 24, 25 }; // Initializing an AtomicIntegerArray with array a AtomicIntegerArray arr = new AtomicIntegerArray(a); // Displaying the AtomicIntegerArray System.out.println("The array : " + arr); // Index to get int idx = 4; // Using get() to retrieve value at idx int val = arr.get(idx); // Displaying the value at idx System.out.println("Value at index " + idx + " is " + val); } } Output: The array : [12, 22, 23, 24, 25] Value at index 4 is 25 Reference: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicIntegerArray.html#get(int) Comment More infoAdvertise with us Next Article AtomicIntegerArray get() method in Java with Examples gopaldave Follow Improve Article Tags : Java Java-Functions Java-concurrent-package Java-AtomicIntegerArray Practice Tags : Java Similar Reads 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 AtomicIntegerArray getAndSet() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.getAndSet() is an inbuilt method in Java that atomically sets a given value at any given position of the AtomicIntegerArray. The method takes the index value of the AtomicIntegerArray and the value to set as the parameters. It returns the value at t 3 min read AtomicIntegerArray getAndAdd() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.getAndAdd() is an inbuilt method in Java that atomically adds the given value to the element at an index of the AtomicIntegerArray. This method takes the index value of the AtomicIntegerArray and the value to be added as the parameters and returns t 3 min read AtomicLongArray get() method in Java with Examples The Java.util.concurrent.atomic.AtomicLongArray.get() is an inbuilt method in java that gets the current value at any position of the AtomicLongArray. This method takes the index value as the parameter and returns the value at this index. Syntax: public final long get(int i) Parameters: The function 2 min read AtomicIntegerArray getAndUpdate() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.getAndUpdate() is an inbuilt method in Java that updates the value at any given index of the AtomicIntegerArray after applying a given update function on the value at that index. The method takes the index value of the AtomicIntegerArray and the upd 3 min read AtomicIntegerArray set() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.set() is an inbuilt method in Java that sets a given value at any position of the AtomicIntegerArray. This method takes the index value of the AtomicIntegerArray as parameter and updates the value at that index. This method does not return any value 2 min read AtomicReferenceArray get() method in Java with Examples The get() method of a AtomicReferenceArray class is used to return the value of the element at index i for this AtomicReferenceArray object with memory semantics of reading as if the variable of index was declared volatile type of variable. Syntax: public final E get(int i) Parameters: This method a 2 min read AtomicIntegerArray length() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.length() is an inbuilt method in Java that returns the length of the AtomicIntegerArray. This method does not accepts any parameter and returns the length of the AtomicIntegerArray which is of type int. Syntax: public final int length() Parameters: 2 min read AtomicIntegerArray getAndIncrement() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.getAndIncrement() is an inbuilt method in Java that atomically increments the value present at any index of an AtomicIntegerArray by one. The method takes the index value of the AtomicIntegerArray as the parameter, returns the value at that index be 3 min read AtomicIntegerArray getAndDecrement() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.getAndDecrement() is an inbuilt method in Java that atomically decrements the value at a given index by one. This method takes the index value of the AtomicIntegerArray and returns the value present at that index and then decrements the value at tha 3 min read Like