Can anbody please help me understand why this long argument is getting rounded to Integer.MAX_VALUE when I use Math.round function?
There is no round() method that takes an long. One takes a float, the other takes a double. Since you didn't explicitly cast it, it will be casted to a float. The float version returns an int -- and not a long.