round
public static long round(double a)
Returns the closest long to the argument, with ties rounding to positive infinity.
Special cases:
If the argument is NaN, the result is 0.
If the argument is negative infinity or any value less than or equal to the value of Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE.
If the argument is positive infinity or any value greater than or equal to the value of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE.
Parameters:
a - a floating-point value to be rounded to a long.
Returns:
the value of the argument rounded to the nearest long value.
See Also:
Long.MAX_VALUE, Long.MIN_VALUE
I say:
why is there no reference to what happens when the double value is exactly (as far as thats possible for floating numbers) between 2 integers? this is totally skipped over in the question. I'm used to round to the ceiling instead of the floor, meaning that round(0.5) == 1 but appearently this isnt the case and im quite suprised this isnt discussed in the answers to the question or at least in the API
