Format double Number in #,##0 format - Android java.lang

Android examples for java.lang:Double

Description

Format double Number in #,##0 format

Demo Code

import java.text.DecimalFormat;

public class Main {

  public static String formattedNumber(double number) {
   /*from   w  w w  .  java2 s  .co  m*/

    String fn = "0";

    DecimalFormat df = new DecimalFormat("#,##0");
    fn = df.format(number);

    return fn;
  }

}

Related Tutorials