Java Decimal Round roundTwoDecimals(double d)

Here you can find the source of roundTwoDecimals(double d)

Description

round Two Decimals

License

Open Source License

Declaration

public static String roundTwoDecimals(double d) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DecimalFormat;

public class Main {
    public static String roundTwoDecimals(double d) {
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        return twoDForm.format(d);
    }/*www  .  j a  v  a  2  s  .  c om*/

    public static String roundTwoDecimals(float f) {
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        return twoDForm.format(f);
    }
}

Related

  1. roundOffToTwoDecimal(double value)
  2. roundThreeDecimals(double d)
  3. roundTwoDecimals(double d)
  4. roundTwoDecimals(double d)
  5. roundTwoDecimals(Double d)
  6. to_decimal(double v)
  7. toLimitDecimalFloatStr(double number, int newScale)
  8. toNumber(Double value, Double defaultValue)
  9. truncate(double d, int digits)