Choice Format : ChoiceFormat « I18N « Java Tutorial






import java.text.ChoiceFormat;

public class ChoiceFormatApp {
  public static void main(String args[]) {
    double limits[] = { 0.0, 0.1, 0.3, 0.7 };
    String labels[] = { "very low", "low", "moderate", "high" };
    ChoiceFormat format = new ChoiceFormat(limits, labels);
    double r = Math.random();
    
    System.out.println(format.format(r) + " (" + r + ").");
  }
}
//high (0.755370803805559).








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