public static int round(final float value){
  final int bits=Float.floatToRawIntBits(value);
  final int biasedExp=bits >> 23 & 0xFF;
  final int shift=23 - 1 + MAX_FLOAT_EXPONENT - biasedExp;
  if ((shift & -32) == 0) {
    int extendedMantissa=0x00800000 | bits & 0x007FFFFF;
    if (bits < 0) {
      extendedMantissa=-extendedMantissa;
    }
    return (extendedMantissa >> shift) + 1 >> 1;
  }
 else {
    return (int)value;
  }
}

public static int round ( final float value ) { final int bits = Float . floatToRawIntBits ( value ) ; final int biasedExp = bits > > 23 & 0xFF ; final int shift = 23 - 1 + MAX_FLOAT_EXPONENT - biasedExp ; if ( ( shift & - 32 ) == 0 ) { int extendedMantissa = 0x00800000 | bits & 0x007FFFFF ; if ( bits < 0 ) { extendedMantissa = - extendedMantissa ; } return ( extendedMantissa > > shift ) + 1 > > 1 ; } else { return ( int ) value ; } }
might have different semantics than math . round ( float ) , see bugs 6430675 and 8010430 .
