Code example for AtomicInteger

Methods: addAndGet

0
        private Semaphore mFinish;
        private String mTarget;
        private boolean mPassed;
         
        public void IncrementProgress(int additional_bytes_written) {
            int val = mBytesWritten.addAndGet(additional_bytes_written);
            Log.i("Connection", val + " bytes written!");
        } 
         
        public int BytesWritten() { 
            return mBytesWritten.get();
        } 
         
        public int TotalBytes() { 
            return mTotalBytes;
        } 
         
        public int PercentComplete() { 
            return( (100)*mBytesWritten.get()) / mTotalBytes;
        }