private int calcLastPage ( int total , int pageSize ) { if ( total == 0 ) { return firstPage ; } else { final int zeroBasedPageNo = total % pageSize > 0 ? total / pageSize : total / pageSize - 1 ; return firstPage + zeroBasedPageNo ; } }
Returns the number of the last page if the total number of items is known .