Need: Now have 109 data, each page shows 10, then how many pages?
obviously, less than 10 will occupy a page.
public class DataPage
{
public static void Main (string[] args)
{
int datacount = 109;
int pagesize = 10;
int datapage = Datacount/pagesize = = 0? Datacount/datasize:datacount/datasize + 1;
System.out.println (DataPage);
}
}
======================================================
Expand: What is the number of pages on the next page?
Above, a total of 11 pages, if the current page number is 1-10, then the next page page number value is on the current page number +1, if the current page number is 11, then no 1, still 11.
public class NextPage
{
public static void Main (string[] args)
{
int totalpage = 11;
int currentpage = 10;
int nextpage = currentpage + 1 <= 10? CurrentPage + 1;totalpage;
System.out.println (currentpage);
}
}
Think: Ask for a page number?
This article is from the "Another_me" blog, make sure to keep this source http://huzunqian.blog.51cto.com/7835027/1886063
Java_ Pagination Demo