We would like to know how to set minimum field-width specifier to the %f conversion.
import java.util.Formatter; // w w w .j a v a 2 s.c o m public class Main { public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("|%f|%n|%12f|%n|%012f|", 10.12345, 10.12345, 10.12345); System.out.println(fmt); } }
The code above generates the following result.