JAvaでDoubleクラスの数字が大きすぎると、科学的なカウント法ではなくページが正常に表示されます.

3277 ワード

    /**
     *           10   ,           。            。
     * @param value
     * @return Sting
     */
    public static String formatFloatNumber(double value) {
        if(value != 0.00){
            java.text.DecimalFormat df = new java.text.DecimalFormat("########.00");
            return df.format(value);
        }else{
            return "0.00";
        }

    }
    public static String formatFloatNumber(Double value) {
        if(value != null){
            if(value.doubleValue() != 0.00){
                java.text.DecimalFormat df = new java.text.DecimalFormat("########.00");
                return df.format(value.doubleValue());
            }else{
                return "0.00";
            }
        }
        return "";
    }

 
DecimalFormat   format   =   (DecimalFormat)   NumberFormat.getPercentInstance(); 
format.applyPattern( "#####0 "); 
String   temp   =   format.format(Double.MAX_VALUE); 
System.out.println(temp);

 
double   a;   //   test 
DecimalFormat   df   =     new   DecimalFormat( "###############0.00 ");//   16    ,     
String   temp     =   df.format(a); 
System.out.println(temp);