Java AtomicLongArray .incrementAndGet (int i)
Syntax
AtomicLongArray.incrementAndGet(int i) has the following syntax.
public final long incrementAndGet(int i)
Example
In the following code shows how to use AtomicLongArray.incrementAndGet(int i) method.
import java.util.concurrent.atomic.AtomicLongArray;
/*from ww w . j ava2s. c o m*/
public class Main {
public static void main(String[] argv) throws Exception {
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[]{1L,2L,3L,4L});
System.out.println(atomicLongArray.incrementAndGet(2));
System.out.println(atomicLongArray);
}
}
The code above generates the following result.