Class Details

Class ChoiceFormat

public class
							ChoiceFormat
                 extends NumberFormat

The ChoiceFormat class is useful for formatting a range of numbers. It is often used in a MessageFormat for dealing with plurals. The choices are specified with a list of doubles in ascending order. The ChoiceFormat class differs from the other formatting classes in this package because it requires the use of a constructor, rather than a factory method, such as getInstance(). A ChoiceFormat is specified with two formats: limits and values. Here's a short code snippet that you could make part of a program:

 double[] limitArray = { 1,2,3,4,5,6}; String[] formatArray ...

Get PURE Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.