void addPage(int pageIndex) {
        int size = pages.size();
        if(size == 0) {
            pages.add(new Integer(pageIndex));
        }
        // Even, so last entry is end of range
        else if((size % 2) == 0) {
            Integer end = (Integer) pages.get(size-1);
            // Continuing the existing sequential page range
            if(end.intValue() == (pageIndex-1)) {
                pages.set(size-1, new Integer(pageIndex));
            }
            // Starting a new page range
            else if(end.intValue() < (pageIndex-1)) {
                pages.add(new Integer(pageIndex));
            }
        }
        // Odd, so last entry is start of range
        else {
            Integer begin = (Integer) pages.get(size-1);
            // Continuing the existing sequential page range
            if(begin.intValue() == (pageIndex-1)) {
                pages.add(new Integer(pageIndex));
            }
            // Starting a new page range, end the previous one first
            else if(begin.intValue() < (pageIndex-1)) {
                pages.add(begin);
                pages.add(new Integer(pageIndex));
            }
        }
    }