Java Float Number Round round(float Rval, int Rpl)

Here you can find the source of round(float Rval, int Rpl)

Description

Rounds the Rval to the number of places in Rpl

License

Open Source License

Parameter

Parameter Description
Rval value to round
Rpl number of places to round to

Return

rounds the given value to the decimal places requested.

Declaration

public static String round(float Rval, int Rpl) 

Method Source Code


//package com.java2s;

import java.text.NumberFormat;

public class Main {
    /**//www .j ava2  s .c  o  m
     * Rounds the Rval to the number of places in Rpl
     * @param Rval value to round
     * @param Rpl  number of places to round to
     * @return rounds the given value to the decimal places requested.
     */
    public static String round(float Rval, int Rpl) {
        NumberFormat fmt = NumberFormat.getInstance();
        fmt.setMaximumFractionDigits(Rpl);
        return fmt.format(Rval);
    }
}

Related

  1. round(float input)
  2. round(float input)
  3. round(float number, int fractionalPartSize)
  4. round(float pX)
  5. round(float Rval, int Rpl)
  6. round(float v)
  7. round(float val, int places)
  8. round(float value, float epsilon)
  9. round(float value, float snap)