double d = 1.2;

// Get the largest double less than d
double d1 = ChoiceFormat.previousDouble(d); // 1.1999999999999997

// Get the smallest double greater than d
double d2 = ChoiceFormat.nextDouble(d);     // 1.2000000000000002

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.