I'm trying to print out a float value in plain text with two decimal values (if possible). For example, if I had 229806210.039999 in the database, then I would like to print it out as 229806210.04, but for some reason it's printing out in scientific notation: 2.29806208E8, which is incorrect in that the last two digit is 08 instead of 10. I tried to convert the number to double and currency format before printing it out but the number is still off (last two digit as 08 instead of 10). Is there a way to address this issue? Here's what I have now:
float amount = 0;
amount = something.getAmount() //this will run the query
//to retrieve the amount stored in database (i.e. 229806210.039999)
Stringbuilder buffer = new StringBuilder();
buffer.append ("the amount = " + amount)
emailObject.setBody(buffer.toString());
emailService.sendEmail(emailObject);