Reputation: 917
I want to round off a value for ex:
12.166666 ----> 12.00
12.49999 ----> 12.00
12.5111 ----> 13.00
12.9999 ----> 13.00
I want to to round off wrt 50 paise.
Upvotes: 0
Views: 14029
Reputation: 92274
You can use Math.round
. For documentation take a look at:
http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#round(double)
Upvotes: 0
Reputation: 52185
You can take a look at the Math.round(double a)
method.
System.out.println(Math.round(12.51));//Yields 13
System.out.println(Math.round(12.49));//Yields 12
System.out.println(Math.round(12.50));//Yields 13
Upvotes: 9