Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String convertToDecimal(String val) { String convertedValue = ""; try { DecimalFormat df = new DecimalFormat("0.00"); convertedValue = df.format(Double.parseDouble(val)); df.setMaximumFractionDigits(2); } catch (NumberFormatException e) { e.printStackTrace(); } return convertedValue; } }