java商品分页代码 java分页实现原理( 七 )


if (totalRowCount % maxPageRowCount0) { //有余数
pageCount = totalRowCount / maxPageRowCount + 1;
}
else {
pageCount = totalRowCount / maxPageRowCount;
}
【java商品分页代码 java分页实现原理】}
/**
* getMaxPageRows
*/
public int getMaxPageRows() {
return maxPageRowCount;
}
//私有方法,返回集合中指定范围的数据
private Object getElementsAt(Collection model, int fromIndex, int toIndex) {
Iterator iter = model.iterator();
ArrayList arr = new ArrayList();
if (iter != null) {
int i = 0;
while (iter.hasNext()) {
Object obj=iter.next();
if (i = fromIndexi = toIndex) {
arr.add(obj);
}
if (itoIndex) {
break;
}
i = i + 1;
}
}
return arr;
}
}
java商品分页代码的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于java分页实现原理、java商品分页代码的信息别忘了在本站进行查找喔 。