Percent value format
import java.text.MessageFormat;
public class Main {
public static void main(String[] argv) throws Exception {
Object[] params = new Object[] { new Double(123.45), new Double(1234.56) };
String msg = MessageFormat
.format("{0,number,percent} a''s and {1,number,percent} b''s", params);
System.out.println(msg);
}
}
//12,345% a's and 123,456% b's
Related examples in the same category