@@ -0,0 +1,850 @@
+package com.example.basic;%0A%0Aimport java.util.concurrent.atomic.AtomicInteger;%0A%0Apublic class AtomicIntegerCompareTest %7B%0A%09private int value;%0A%0A%09public AtomicIntegerCompareTest(int value) %7B%0A%09%09this.value = value;%0A%09%7D%0A%0A%09public synchronized int increase() %7B%0A%09%09return value++;%0A%09%7D%0A%0A%09public static void main(String args%5B%5D) %7B%0A%09%09long start = System.currentTimeMillis();%0A%0A%09%09AtomicIntegerCompareTest test = new AtomicIntegerCompareTest(0);%0A%09%09for (int i = 0; i %3C 1000000; i++) %7B%0A%09%09%09test.increase();%0A%09%09%7D%0A%09%09long end = System.currentTimeMillis();%0A%09%09System.out.println(%22time elapse:%22 + (end - start));%0A%0A%09%09long start1 = System.currentTimeMillis();%0A%0A%09%09AtomicInteger atomic = new AtomicInteger(0);%0A%0A%09%09for (int i = 0; i %3C 1000000; i++) %7B%0A%09%09%09atomic.incrementAndGet();%0A%09%09%7D%0A%09%09long end1 = System.currentTimeMillis();%0A%09%09System.out.println(%22time elapse:%22 + (end1 - start1));%0A%0A%09%7D%0A%7D

add atomic integer demo