AtomicLongArray length() method in Java with Examples Last Updated : 08 Feb, 2019 Comments Improve Suggest changes Like Article Like Report The Java.util.concurrent.atomic.AtomicLongArray.length() is an inbuilt method in Java that returns the length of the AtomicLongArray. This method does not accepts any parameter and returns the length of the AtomicLongArray which is of type int. Syntax: public final int length() Parameters: The function does not accept any parameter. Return Value: The function returns the length of the AtomicLongArray. Below programs illustrate the above method: Program 1: Java // Java program that demonstrates // the length() function import java.util.concurrent.atomic.AtomicLongArray; public class GFG { public static void main(String args[]) { // Initializing an array long a[] = { 11, 12, 13, 14, 15 }; // Initializing an AtomicLongArray with array a AtomicLongArray arr = new AtomicLongArray(a); // Displaying the length of the AtomicLongArray System.out.println("The length of the array : " + arr.length()); } } Output: The length of the array : 5 Program 2: Java // Java program that demonstrates // the length() function import java.util.concurrent.atomic.AtomicLongArray; public class GFG { public static void main(String args[]) { // Initializing an array long a[] = { 11, 12, 13, 14, 15, 16, 17 }; // Initializing an AtomicLongArray with array a AtomicLongArray arr = new AtomicLongArray(a); // Displaying the length of the AtomicLongArray System.out.println("The length of the array : " + arr.length()); } } Output: The length of the array : 7 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicLongArray.html#length-- Comment More infoAdvertise with us Next Article AtomicLongArray length() method in Java with Examples R rupesh_rao Follow Improve Article Tags : Java Java - util package Java-Functions Java-AtomicLongArray Practice Tags : Java Similar Reads 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 AtomicReferenceArray length() method in Java with Examples The length() method of a AtomicReferenceArray class is used to return the length of this AtomicReferenceArray. Syntax: public final int length() Parameters: This method accepts nothing. Return value: This method returns the integer representing length of this AtomicReferenceArray. Below programs ill 1 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 AtomicLongArray toString() method in Java with Examples The Java.util.concurrent.atomic.AtomicLongArray.toString() is an inbuilt method in Java that returns a string that textually represents the current values of the AtomicLongArray. The resulting string is a concise and informative representation that is easy for a person to read. It is used to easily 2 min read AtomicLongArray getAndAdd() method in Java with Examples The Java.util.concurrent.atomic.AtomicLongArray.getAndAdd() is an inbuilt method in Java that atomically adds the given value to the element at an index of the AtomicLongArray. This method takes the index value of the AtomicLongArray and the value to be added as the parameters and returns the value 3 min read Like