private int rangeCheck(int value, int begin, int end) {
        if (value > begin && value <= end) { // (begin,end]
            return value;
        }

        throw new IllegalArgumentException("Value [" + value + "] not in range ("+begin+","+end+"]");
    }