public static long round(final double value){
  final long bits=Double.doubleToRawLongBits(value);
  final int biasedExp=(int)(bits >> 52) & 0x7FF;
  final int shift=52 - 1 + MAX_DOUBLE_EXPONENT - biasedExp;
  if ((shift & -64) == 0) {
    long extendedMantissa=0x0010000000000000L | bits & 0x000FFFFFFFFFFFFFL;
    if (bits < 0) {
      extendedMantissa=-extendedMantissa;
    }
    return (extendedMantissa >> shift) + 1L >> 1;
  }
 else {
    if (ANTI_SLOW_CASTS) {
      if (Math.abs(value) >= -(double)Long.MIN_VALUE) {
        return value < 0.0 ? Long.MIN_VALUE : Long.MAX_VALUE;
      }
    }
    return (long)value;
  }
}

public static long round ( final double value ) { final long bits = Double . doubleToRawLongBits ( value ) ; final int biasedExp = ( int ) ( bits > > 52 ) & 0x7FF ; final int shift = 52 - 1 + MAX_DOUBLE_EXPONENT - biasedExp ; if ( ( shift & - 64 ) == 0 ) { long extendedMantissa = 0x0010000000000000L | bits & 0x000FFFFFFFFFFFFFL ; if ( bits < 0 ) { extendedMantissa = - extendedMantissa ; } return ( extendedMantissa > > shift ) + 1L > > 1 ; } else { if ( ANTI_SLOW_CASTS ) { if ( Math . abs ( value ) >= - ( double ) Long . MIN_VALUE ) { return value < 0.0 ? Long . MIN_VALUE : Long . MAX_VALUE ; } } return ( long ) value ; } }
might have different semantics than math . round ( double ) , see bugs 6430675 and 8010430 .
