Right now I'm trying this:
int a = round(n);
where n
is a double
but it's not working. What am I doing wrong?
What is the return type of the round()
method in the snippet?
If this is the Math.round()
method, it returns a Long when the input param is Double.
So, you will have to cast the return value:
int a = (int) Math.round(doubleVar);