public static int checkPositionIndex(int index, int size, @Nullable String desc) {
        if (index >= 0 && index <= size) {
            return index;
        } else {
            throw new IndexOutOfBoundsException(badPositionIndex(index, size, desc));
        }
    }
================================================
Created by JessYan on 26/09/2016 13:59
<a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
<a href="https://github.com/JessYanCoding">Follow me</a>
================================================
arms/src/main/java/com/jess/arms/utils/Preconditions.java