int total = (int) Math.ceil(157/32);
Why does it still return 4?
157/32 = 4.90625, I need to round up, I’ve looked around and this seems to be the right method.
doubletype, but get 4.0.
What am I doing wrong?
You are doing
157/32which is dividing two integers with each other, which always result in a rounded down integer. Therefore the
(int) Math.ceil(...)isn’t doing anything. There are three possible solutions to achieve what you want. I recommend using either option 1 or option 2. Please do NOT use option 0.