Tutorials Point


  Java Basics
  Java Object Oriented
  Java Advanced
  Java Useful References
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java - rint() Method


previous next AddThis Social Bookmark Button


Description:

The method rint returns the integer that is closest in value to the argument.

Syntax:

double rint(double d)

Parameters:

Here is the detail of parameters:

  • A double primitive data type

Return Value :

  • Returns the integer that is closest in value to the argument. Returned as a double.

Example:

public class Test{ 
   public static void main(String args[]){
      double d = 100.675;
      double e = 100.500;
      double f = 100.200;

      System.out.println(Math.rint(d));
      System.out.println(Math.rint(e)); 
      System.out.println(Math.rint(f)); 
   }
}

This produces following result:

101.0
100.0
100.0


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names