Formatting this number

Programming
Tutor: None Selected Time limit: 3 Days

i would like this tiny bit of help.

i built this little program that calculates stuff(unimportant what it calculates).

but sometimes when its dividing or multiplying big numbers, it displays it in the scientific notification.

like it should display: 10000000(10 million)

but it displays: 1.0E7.

how can i fix this? i dont want it to display it in the scientific notifitcation.

code:

[CODE]if(e.getSource()==b1 && box.getSelectedItem()==fish[8]){

String xp1 = txt1.getText();

int xp2 = Integer.parseInt(xp1);

String xp3 = txt2.getText();

int xp4 = Integer.parseInt(xp3);

double xpleft = xp4 - xp2 ;

double fishleft = xpleft / 350;

JOptionPane.showMessageDialog(null, "XP left: "+"\t"+xpleft+"\n"+box.getSelectedItem()+" left: "+"\t"+fishleft+"\n"+"\n"+"NOTE: always round these numbers."+"\n"+"example: fish left: 1,87 = fish left: 2.", "Fishing Calculator", JOptionPane.INFORMATION_MESSAGE);[/CODE]


Nov 30th, -0001

public static String formatDecimal(double d, int precision)
{
String myformat = "###,###,###,###,##0";
if (precision == 0)
{
//System.out.println("OK Decimal is: " + d);
DecimalFormat df = new DecimalFormat(myformat);
return df.format(d);
}

myformat = "###,###,###,###,##0.";

for(int x= 0; x < precision; x++)
myformat = myformat + "0";

DecimalFormat df = new DecimalFormat(myformat);
return df.format(d);
}
public static String round_my_float(float f, int places)
{
String precision = "";
if (places == 0)
precision = "0";
else
precision = "0.";
for(int y = 0; y < places; y++)
precision += "0";

//DecimalFormat df=new DecimalFormat("0.000");
DecimalFormat df=new DecimalFormat(precision);
return df.format(f);
}
}
Jun 9th, 2013

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Nov 30th, -0001
...
Nov 30th, -0001
Dec 5th, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer