@@ -0,0 +1,1020 @@
+public class PageIndex %7B%0A%09private long startindex;%0A%09private long endindex;%0A%09%0A%09public PageIndex(long startindex, long endindex) %7B%0A%09%09this.startindex = startindex;%0A%09%09this.endindex = endindex;%0A%09%7D%0A%09public long getStartindex() %7B%0A%09%09return startindex;%0A%09%7D%0A%09public void setStartindex(long startindex) %7B%0A%09%09this.startindex = startindex;%0A%09%7D%0A%09public long getEndindex() %7B%0A%09%09return endindex;%0A%09%7D%0A%09public void setEndindex(long endindex) %7B%0A%09%09this.endindex = endindex;%0A%09%7D%0A%09 %0A%09public static PageIndex getPageIndex(long viewpagecount, int currentPage, long totalpage)%7B%0A%09%09%09long startpage = currentPage-(viewpagecount%252==0? viewpagecount/2-1 : viewpagecount/2);%0A%09%09%09long endpage = currentPage+viewpagecount/2;%0A%09%09%09if(startpage%3C1)%7B%0A%09%09%09%09startpage = 1;%0A%09%09%09%09if(totalpage%3E=viewpagecount) endpage = viewpagecount;%0A%09%09%09%09else endpage = totalpage;%0A%09%09%09%7D%0A%09%09%09if(endpage%3Etotalpage)%7B%0A%09%09%09%09endpage = totalpage;%0A%09%09%09%09if((endpage-viewpagecount)%3E0) startpage = endpage-viewpagecount+1;%0A%09%09%09%09else startpage = 1;%0A%09%09%09%7D%0A%09%09%09return new PageIndex(startpage, endpage);%09%09%0A%09%7D%0A%7D%0A

Create PageIndex.java