Java Double Number Format formatDouble(double val, int precision)

Here you can find the source of formatDouble(double val, int precision)

Description

format Double

License

Apache License

Declaration

public static String formatDouble(double val, int precision) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String formatDouble(double val, int precision) {
        String format_string = "%1$." + precision + "f";
        return String.format(format_string, val);
    }//from w w w  .  jav  a  2s  . c  o m
}

Related

  1. formatDouble(double source, int decimals, int precision)
  2. formatDouble(double v, int decimalPlaces)
  3. formatDouble(double val)
  4. formatDouble(double val)
  5. formatDouble(double val, int prec)
  6. formatDouble(double value)
  7. formatDouble(double value)
  8. formatDouble(double value)
  9. formatDouble(double value)