is there a possibility that casting a double created via
Math.round()will still result in a truncated down number
round() will always round your double to the correct value, and then, it will be cast to an
long which will truncate any decimal places. But after rounding, there will not be any fractional parts remaining.
Here are the docs from
Returns the closest long to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long. In other words, the result is equal to the value of the expression:
(long)Math.floor(a + 0.5d)