Example usage for java.lang StrictMath rint

List of usage examples for java.lang StrictMath rint

Introduction

In this page you can find the example usage for java.lang StrictMath rint.

Prototype

public static double rint(double a) 

Source Link

Document

Returns the double value that is closest in value to the argument and is equal to a mathematical integer.

Usage

From source file:Main.java

public static void main(String[] args) {

    double d1 = 1.2, d2 = 34.5, d3 = 6.7;

    System.out.println("integer value closest to " + d1 + " = " + StrictMath.rint(d1));

    System.out.println("integer value closest to " + d2 + " = " + StrictMath.rint(d2));

    System.out.println("integer value closest to " + d3 + " = " + StrictMath.rint(d3));
}