用这个:
public abstract class NumberFormatextends FormatNumberFormat is the abstract base class for all number formats. This class provides the interface for formatting and parsing numbers. NumberFormat also provides methods for determining which locales have number formats, and what their names are. NumberFormat helps you to format and parse numbers for any locale. Your code can be completely independent of the locale conventions for decimal points, thousands-separators, or even the particular decimal digits used, or whether the number format is even decimal. 

解决方案 »

  1.   

    DecimalFormat就是它的子类        DecimalFormat format = new DecimalFormat("0.000000000");
            double d = 12.1234567891;
            System.out.println(format.format(d));
      

  2.   

    import java.text.NumberFormat;public class TestNumberFormat {
    public static void main(String[] args) {
    System.out.println(formatDouble(2.33));
    } public static String formatDouble(double num) {
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(9);
    nf.setMinimumFractionDigits(9);
    return nf.format(num);
    }
    }
      

  3.   

    你们的都不可以啊,因为我返回后的值是double类型的,如果转成double的又不能有九位小数