If I have 2 database records and 25 records per page, then the following code:
System.out.println("page count: " + (double)2/25);
results in this output:
page count: 0.08
But because I am using this figure for pagination, I need the next highest integer, in this case: 1.
Both Math.ceil and Math.abs produce the result 0 or 0.0.
How do I end up with a page number integer?
The correct way to do that is:
In your case: pages = (2 + 25 – 1)/25 = 26/25 = 1