<strong>
public
class
Page {
private
long totalCount = 0;
private
int pageNumber = 1;
private
int pageSize = 20;
private
int totalPage = 0;
private
int startRow = 0;
public
void pagination() {
if
(this.totalCount % pageSize == 0)
this.totalPage =
new
Long(this.totalCount / pageSize).intValue();
else
this.totalPage =
new
Long(this.totalCount / pageSize).intValue() + 1;
if
(this.pageNumber <1)
this.pageNumber = 1;
if
(this.pageNumber > this.totalPage)
this.pageNumber = this.totalPage;
this.startRow = (this.pageNumber - 1) * this.pageSize;
}
public
long getTotalCount() {
return
totalCount;
}
public
void setTotalCount(long totalCount) {
this.totalCount = totalCount;
this.pagination();
}
public
int getPageNumber() {
return
pageNumber;
}
public
void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public
int getPageSize() {
return
pageSize;
}
public
void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public
int getTotalPage() {
return
totalPage;
}
public
void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public
int getStartRow() {
return
startRow;
}
public
void setStartRow(int startRow) {
this.startRow = startRow;
}
}</strong>