how can i round up a floating point number to the next integer value in Java? Suppose
2.1 -->3 3.001 -->4 4.5 -
2.1 -->3
3.001 -->4
4.5 -
If it helps someone, here's how I get this working:
int arraySize = 3; int pageSize = 10; int pagesQty = (int) Math.ceil(arraySize / (float) pageSize); System.out.println(pagesQty); //Displays 1
Divisor must be a float in order to work properly.