Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String getTwoPointString(double d) { if (d == 0) return "0.00"; try { DecimalFormat df = new DecimalFormat("######0.00"); String text = df.format(d); return text; } catch (Exception e) { return "0.00"; } } }