Java tutorial
//package com.java2s; public class Main { public static double roundOffToTwoDecimal(double valueDouble) { double roundOff = (double) Math.round(valueDouble * 100) / 100; return roundOff; } public static String roundOffToTwoDecimal(String valueStr) { double valueDouble = new Double(valueStr).doubleValue(); double roundOff = (double) Math.round(valueDouble * 100) / 100; return new Double(roundOff).toString(); } }