i am getting double values,i need to reduce to approximative value after . for example
i have 123.678,i need to format this as 124.
if i have 123.212 i need to format this as 123
how can i done this,can any one please help me.
Thank u in advance.
i am getting double values,i need to reduce to approximative value after . for example
i have 123.678,i need to format this as 124.
if i have 123.212 i need to format this as 123
how can i done this,can any one please help me.
Thank u in advance.
Sounds like you want Math.round() for floats or Math.round() for doubles
public static int round(float a)
public static long round(double a)
Returns the closest int/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 int/long.
In other words, the result is equal to the value of the expression: (int)Math.floor(a + 0.5f) or (long)Math.floor(a + 0.5d)