Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static double roundTwoDecimals(double d) { // try { //DecimalFormat twoDForm = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.getDefault())); // NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN); DecimalFormat dFormat = new DecimalFormat("####,###,###.#"); return Double.valueOf(dFormat.format(d)); /**} catch (Exception exx) { return d; }**/ } }