Java Fraction Format formatDouble(double aValue)

Here you can find the source of formatDouble(double aValue)

Description

format Double

License

Apache License

Declaration

public static String formatDouble(double aValue) 

Method Source Code

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

import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

public class Main {
    public static String formatDouble(double aValue) {
        DecimalFormat formatter = new DecimalFormat();
        formatter.setGroupingUsed(false);
        formatter.setMinimumIntegerDigits(1);
        formatter.setMaximumFractionDigits(100);
        formatter.setRoundingMode(RoundingMode.DOWN);
        DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
        symbols.setDecimalSeparator('.');
        formatter.setDecimalFormatSymbols(symbols);
        return formatter.format(aValue);
    }//from w  w w  .  ja va 2  s .  c  o m
}

Related

  1. formatDistance(float distance)
  2. formatDollarAmount(float amount)
  3. formatDoube(double val)
  4. formatDouble(DecimalFormat fmt, double value)
  5. formatDouble(Double amount, String format)
  6. formatDouble(double d)
  7. formatDouble(Double d)
  8. formatDouble(double d)
  9. formatDouble(double d)