public void removeFromEnd(int numOfElements) {
        if (numOfElements <= 0) {
            return;
        }
        if (numOfElements > size()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        int start = 0;
        if (numOfElements < mTail) {
            start = mTail - numOfElements;
        }
        for (int i = start; i < mTail; i++) {
            mElements[i] = null;
        }
        int removed = (mTail - start);
        numOfElements -= removed;
        mTail = mTail - removed;
        if (numOfElements > 0) {
            // mTail wrapped to mElements.length
            mTail = mElements.length;
            int newTail = mTail - numOfElements;
            for (int i = newTail; i < mTail; i++) {
                mElements[i] = null;
            }
            mTail = newTail;
        }
    }
Remove multiple elements from end of the CircularArray, ignore when numOfElements
is less than or equals to 0.

@param numOfElements Number of elements to remove.
@throws ArrayIndexOutOfBoundsException if numOfElements is larger than
                                       {@link #size()}
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/collection/CircularArray.java