Here you can find the source of Round(double d, int Rpl)
Parameter | Description |
---|---|
d | the double to be rounded |
Rpl | the number of places to round to |
public static float Round(double d, int Rpl)
//package com.java2s; //License from project: LGPL public class Main { /**//from w ww .j a v a 2s . c o m * rounds a number to RPL places * * @param d * the double to be rounded * @param Rpl * the number of places to round to * @return the rounded double */ public static float Round(double d, int Rpl) { float p = (float) Math.pow(10, Rpl); d = d * p; float tmp = Math.round(d); return (float) tmp / p; } }