Java tutorial
//package com.java2s; public class Main { /** * Returns next bigger float value considering precision of the argument. * */ public static float nextUpF(float f) { if (Float.isNaN(f) || f == Float.POSITIVE_INFINITY) { return f; } else { f += 0.0f; return Float.intBitsToFloat(Float.floatToRawIntBits(f) + ((f >= 0.0f) ? +1 : -1)); } } }