Java Number Round roundFormat(final int numPrec, final double number)

Here you can find the source of roundFormat(final int numPrec, final double number)

Description

Round format.

License

LGPL

Parameter

Parameter Description
numPrec the num prec
number the number

Return

the string

Declaration

public static String roundFormat(final int numPrec, final double number) 

Method Source Code

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

public class Main {
    /**//from w  ww . j  a v  a  2  s. com
     * Round format.
     *
     * @param numPrec the num prec
     * @param number the number
     * @return the string
     */
    public static String roundFormat(final int numPrec, final double number) {
        return String.format("%." + numPrec + "f", number);
    }
}

Related

  1. roundf(float value)
  2. roundFileLength(long nbytes)
  3. roundFloat(float value, int afterDecimalPoint)
  4. roundFloatToPlace(float f, int place)
  5. roundFloatToUnitInverse(final float graphValue, final float graphUnit)
  6. RoundFullUp(double d)
  7. roundHalfAway(double d)
  8. RoundHalfUp(double d)
  9. roundIfClose(double val)