
How do you typecast a double into an int in java so that it doesn’t round up to the next number? Thanks?
Example, to typecast 2.8 into just 2, and not 3.
Look at the floor() function in java.lang.Math. This will round down, but the result is still a double, so you must cast it to an int manually.
Java tutorial in Eclipse (class java.lang.Double)