Java NumberFormat.format(double number)

Syntax

NumberFormat.format(double number) has the following syntax.

public final String format(double number)

Example

In the following code shows how to use NumberFormat.format(double number) method.


/*from w  w  w.  ja  v a  2  s .  c  o  m*/
import java.text.NumberFormat;

public class Main {
  public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getPercentInstance();
    System.out.println(numberFormat.format(99.999999));
    
    
  }
}




















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat