Home >>Java Math Methods >Java Math.nextUp() Method
The Math.nextUp() in Java Math is an embedded method which is used to returns the floating-point value in the direction of positive infinity, adjacent to the user-specified parameter (d). This method is similar to a method nextAfter(d, Double. POSITIVE INFINITY).
public static double nextUp(double a) public static float nextUp(float a)
a = This parameter is used to starting floating-point value
It is used to returns the adjacent floating-point value closer to positive infinity.
public class MyClass
{
public static void main(String[] args)
{
float a = 0.0f / 0;
System.out.println(Math.nextUp(a));
}
}
public class MyClass
{
public static void main(String[] args)
{
double a = 363.44;
System.out.println(Math.nextUp(a));
}
}