Round of Float and double values using Roundof method
Previous | Home | Next |
This program shows how the value of number be round of. using Roundof method of math class.
In this program we use Math.round method of Math class of collection class.
This method returns the closest int number to the argument.
Used Math.round method and pass values to it as arguments.
package Example;
public class rRoundExample {
public static void main(String[] args) {
System.out.println(Math.round(23.5f));
System.out.println(Math.round(53.23f));
System.out.println(Math.round(23.12));
}
}
24
53
23
Previous | Home | Next |