Java Number Round roundToInt(final double d)

Here you can find the source of roundToInt(final double d)

Description

Rounds d to an int.

License

Open Source License

Declaration

final public static int roundToInt(final double d) 

Method Source Code

//package com.java2s;
// License as published by the Free Software Foundation; either

public class Main {
    /**//from   w  ww  .  j  ava  2s.c o  m
     * Rounds d to an int.
     */
    final public static int roundToInt(final double d) {
        return (int) (d + 0.5);
    }

    final public static int roundToInt(final float f) {
        return (int) (f + 0.5f);
    }
}

Related

  1. roundToDimensions(int value, int nearestValue)
  2. roundToEight(long i)
  3. roundToHalf(float x)
  4. roundToInt(double d)
  5. roundToInt(double d)
  6. roundToInterval(float num, float interval)
  7. roundToMil(double val)
  8. roundToMultiple(int value, int divisor)
  9. roundToMultiple(int value, int multipleOf)