Duplicate :
|
Name: mf23781 Date: 05/07/98 Using DecimalFormat(###0.0) produces formatted output as ollows: 00.5This should be 0.5 and indeed JDK 115 gets this right. 116 appears to add an extra 0 (although not one for every #). import java.text.*; public class test { public static void main(String argv[]) { DecimalFormat test1 = new DecimalFormat("###0.0"); StringBuffer test2 = new StringBuffer(); FieldPosition test3 = new FieldPosition(0); test1.format(.5,test2,test3); System.out.println(test2); } } ======================================================================