Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BigDecimal showing scientific 0E-7 iso 0.0000000

807607Oct 16 2006 — edited Oct 16 2006
Hi,

Since we moved from JRE1.4.x to 1.5.x we have problems with BigDecimals showing 0E-7 iso 0.0000000
(Scientific format in stead of full value).

I include an example of this.
- When running with jre1.4.x, the example shows 0.0000000
- When running with jre1.5.x, the example shows 0E-7

How can I fix this?

I found some info on changes but no clue on how to solve this, specially when using the BigDecimal objects in a JTable...


package test;

/**
 * @author pgo
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.math.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class OutputBigDecimal
	extends JFrame {
  private Container content;
  private BigDecimal bd = new BigDecimal("0.0000000");
  private JTextField bdvalue = new JTextField();
  
  public static void main(String[] args) {
	new OutputBigDecimal();
  }

  public OutputBigDecimal() {
	super("Output BigDecimal Value:");
	setSize(400, 150);
	content = getContentPane();
	content.setLayout(new FlowLayout());

	bdvalue.setText("Value=" + bd);
	content.add(bdvalue);

	setVisible(true);
	setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2006
Added on Oct 16 2006
4 comments
5,839 views