JDK-4136037 : Incorrect output from DecimalFormat(###0.0) in 1.1.6
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1998-05-07
  • Updated: 1998-05-08
  • Resolved: 1998-05-08
Related Reports
Duplicate :  
Description

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);
}
}


======================================================================