Java examples for java.lang:double
round double to Two Decimal
//package com.java2s; import java.text.DecimalFormat; public class Main { public static double roundTwoDec(double d) { DecimalFormat twoDForm = new DecimalFormat("#.##"); return Double.valueOf(twoDForm.format(d)); }/* w w w . j a v a 2 s .c o m*/ }