Java Fraction Format formatDecimal(double dtSource, String nbit)

Here you can find the source of formatDecimal(double dtSource, String nbit)

Description

format Decimal

License

Apache License

Declaration

public static String formatDecimal(double dtSource, String nbit) 

Method Source Code

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

public class Main {
    public static String formatDecimal(double dtSource, String nbit) {
        java.text.DecimalFormat formatter = null;
        try {//from   w  w  w  .j a  v  a 2s. c o  m
            formatter = new java.text.DecimalFormat("#,###." + nbit);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return formatter.format(dtSource);
    }
}

Related

  1. formatCoordinates(double lat, double lon)
  2. formatCPUUtilization(double d)
  3. formatD(double d)
  4. formatData(double aAmount)
  5. formatDataValue(double value)
  6. formatDecimal(double number)
  7. formatDecimal(double numToFormat)
  8. formatDecimal(double value)
  9. formatDecimal(double value, int maxFractionDigits1, int maxFractionDigits2)