DecimalFormat

I would like to always display a double value only showing one place after the decimal. I was told to use DecimalFormat, but I can't get it to work...what is the best way to do this? Thanx!
[204 byte] By [Babybritn] at [2007-9-26 4:41:10]
# 1

Try this: // given double myDouble...

NumberFormat numFmt = NumberFormat.getNumberInstance() ;

numFmt.setMaximumFractionDigits(1) ;

numFmt.setMinimumFractionDigits(1) ;

String myDoubleStr = numFmt.format(myDouble) ;

note: For most locales, NumberFormat.getNumberInstance() returns a DecimalFormat object.

DragonMan at 2007-6-29 18:03:17 > top of Java-index,Archived Forums,Java Programming...