how to use Math.round() in java for getting =ROUND(A8/1000,2)* 1000 (excel formula) output -


i have value 7075.5 need output 7080. need apply below excel formula output.

=round(a8/1000, 2) * 1000 

how accomplish formula/requirement using java? tried few far away expected output.

public class split {     public static void main(string[] args) {         double e = 7075.9;         system.out.println("rounding 7075.5="+math.round(e*1000)/1000);      } } 

can please done in java? please refer excel formula given above.

why dividing 1000 when want round off last digit?

you can use

system.out.println("rounding 7075.5="+math.round(e/10)*10); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -