Java Float Number Round round(final float a)

Here you can find the source of round(final float a)

Description

Round a

License

Open Source License

Parameter

Parameter Description
a a parameter

Declaration

final static public int round(final float a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   w ww  .  ja v  a  2  s  .  co m
     * Round a
     *
     * @param a
     */
    final static public int round(final float a) {
        return (int) (a + Math.signum(a) * 0.5f);
    }

    /**
     * Round a
     *
     * @param a
     */
    final static public int round(final double a) {
        return (int) (a + Math.signum(a) * 0.5);
    }
}

Related

  1. round(final float f)
  2. round(final float val)
  3. round(final float value)
  4. round(final float x, final float roundFactor)