Java Number Round round(int f)

Here you can find the source of round(int f)

Description

round

License

Artistic License

Declaration

public static int round(int f) 

Method Source Code

//package com.java2s;
/*// w ww .j  a  v a 2 s. c  om
    
 FP version 3.1
    
 Copyright (c) 2004 Andre de Leiradella <leiradella@bigfoot.com>
    
 This program is licensed under the Artistic License.
    
 See http://www.opensource.org/licenses/artistic-license.html for details.
    
 Uses parts or ideas from FPMath. FPMath is copyright (c) 2001 Beartronics and
 is authored by Henry Minsky.
 http://bearlib.sourceforge.net/
    
 Uses parts or ideas from oMathFP. oMathFP is copyright (c) 2004 Dan Carter.
 http://orbisstudios.com/
    
 */

public class Main {
    public static int round(int f) {
        return f < 0 ? -((-f + 32768) & ~0xFFFF) : (f + 32768) & ~0xFFFF;
    }
}

Related

  1. round(final long timeMs, final int precision)
  2. round(int a, int cutOfDigits)
  3. round(int n)
  4. round(int start, int boundary)
  5. round(int t, int n, int decimals)
  6. round(int top, int div2, int divisor)