Mega Code Archive

 
Categories / Java Tutorial / Development
 

The minimum field width specifier by applying it to the %f conversion

import java.util.Formatter; public class MainClass {   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);   } } |10.123450| | 10.123450| |00010.123450|