List of usage examples for java.text ChoiceFormat format
public final String format(double number)
From source file:Main.java
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 + ")."); }