Here you can find the source of formatDouble(double d)
public static String formatDouble(double d)
//package com.java2s; //License from project: Open Source License import java.math.RoundingMode; import java.text.DecimalFormat; public class Main { public static String formatDouble(double d) { DecimalFormat formatter = new DecimalFormat("#0.00"); formatter.setRoundingMode(RoundingMode.HALF_UP); return formatter.format(d); }/*from w ww.ja v a 2 s .c o m*/ }