Here you can find the source of round(float Rval, int Rpl)
Parameter | Description |
---|---|
Rval | value to round |
Rpl | number of places to round to |
public static String round(float Rval, int Rpl)
//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); } }