This is a simple pagination implementation in Java. It supports both offset + limit and page number + page size approaches to specify pagination (paged request) whenever needed by passing it as parameter instead of two integers which could lead to confusion.
===========================
Use this code either by copying simply into codebase or making jar library out of it.