Java Number Round roundToInt(double d)

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

Description

round To Int

License

Apache License

Declaration

public static int roundToInt(double d) 

Method Source Code

//package com.java2s;
/* Copyright (c) 2015 University of Massachusetts
 * //from  ww w.  j av a 2  s  . c o  m
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License. */

public class Main {
    public static int roundToInt(double d) {
        return (int) Math.round(d);
    }
}

Related

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