public static float nextAfter(final float start,final double direction){
  if (direction < start) {
    if (start == 0.0f) {
      return -Float.MIN_VALUE;
    }
    final int bits=Float.floatToRawIntBits(start);
    return Float.intBitsToFloat(bits + (bits > 0 ? -1 : 1));
  }
 else   if (direction > start) {
    final int bits=Float.floatToRawIntBits(start + 0.0f);
    return Float.intBitsToFloat(bits + (bits >= 0 ? 1 : -1));
  }
 else   if (start == direction) {
    return (float)direction;
  }
 else {
    return start + (float)direction;
  }
}

public static float nextAfter ( final float start , final double direction ) { if ( direction < start ) { if ( start == 0.0f ) { return - Float . MIN_VALUE ; } final int bits = Float . floatToRawIntBits ( start ) ; return Float . intBitsToFloat ( bits + ( bits > 0 ? - 1 : 1 ) ) ; } else if ( direction > start ) { final int bits = Float . floatToRawIntBits ( start + 0.0f ) ; return Float . intBitsToFloat ( bits + ( bits >= 0 ? 1 : - 1 ) ) ; } else if ( start == direction ) { return ( float ) direction ; } else { return start + ( float ) direction ; } }
if both arguments are + - 0 . 0 ( f ) , ( float ) direction is returned . if both arguments are + infinity or - infinity , respectively + infinity or - infinity is returned .
