Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String keepTwoDecimalPlaces(double privce) { if (privce != 0) { String keepTwoDecimalPlaces = ""; keepTwoDecimalPlaces = new DecimalFormat("######0.00").format(privce); return keepTwoDecimalPlaces; } else { return "0.00"; } } }