Android examples for java.lang:Double
round double number by decimal Place
import android.content.Context; import android.graphics.Color; import java.text.DecimalFormat; public class Main{ public static String round(double d, int decimalPlace) { DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(decimalPlace); df.setMinimumFractionDigits(decimalPlace); return df.format(d); }// w w w .j av a 2s . co m }