Java Decimal Round toLimitDecimalFloatStr(double number, int newScale)

Here you can find the source of toLimitDecimalFloatStr(double number, int newScale)

Description

to Limit Decimal Float Str

License

Apache License

Declaration

public static String toLimitDecimalFloatStr(double number, int newScale) 

Method Source Code

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

import java.text.NumberFormat;

public class Main {

    public static String toLimitDecimalFloatStr(double number, int newScale) {
        NumberFormat nf = NumberFormat.getNumberInstance();
        nf.setMaximumFractionDigits(newScale);
        return nf.format(number);
    }//from ww  w. j  av a  2s  . c  o m
}

Related

  1. roundTwoDecimals(double d)
  2. roundTwoDecimals(double d)
  3. roundTwoDecimals(Double d)
  4. roundTwoDecimals(double d)
  5. to_decimal(double v)
  6. toNumber(Double value, Double defaultValue)
  7. truncate(double d, int digits)
  8. truncate(final double v, final int sigNumIndex)