import java.text.*;NumberFormat formater = new DecimalFormat("###,###.##");
System.out.println(formater.format(55544.22d));

解决方案 »

  1.   

    import java.text.*;public class kk{
      public static void main( String[] args ){
        DecimalFormat bf = new DecimalFormat( "###,###.##" );
        double d = 55544.22;
        System.out.println( bf.format( d ) );
      }
    }
      

  2.   

    如果要小数点前面保留0则
    public class kk{
      public static void main( String[] args ){
        DecimalFormat bf = new DecimalFormat( "###,##0.##" );
        double d = .22;
        System.out.println( bf.format( d ) );
      }
    }
    结果就是0.22,否则就是.22