Incrementing a Double by the Smallest Possible Amount : ChoiceFormat « I18N « Java Tutorial






import java.text.ChoiceFormat;

public class Main {
  public static void main(String[] argv) throws Exception {

    double d = 1.2;

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








13.10.ChoiceFormat
13.10.1.Choice Format
13.10.2.Incrementing a Double by the Smallest Possible Amount
13.10.3.Get the smallest double greater than d
13.10.4.Implementing a Simple Event Notifier