Java – Math rint() Example, Math rint() Program


Math class is part of java.lang package. Math rint method returns the argument that is close to integer number in fraction. rint function return type is double.

Math rint example explains how to use Math rint function in java.

public class JavaMathRintExample {
    public static void main(String[] args) {
        double E1 = Math.rint(2323.4393086905318781);
        double E2 = Math.rint(2323.8393086905318781);
        System.out.println("Math rint value :"+E1);
        System.out.println("Math rint value :"+E2);


Math rint value :2323.0
Math rint value :2324.0



Leave a Reply