Java tutorial
//package com.java2s; import java.text.NumberFormat; public class Main { protected static String format(String value) { Double myNumber = Double.valueOf(value); NumberFormat format = NumberFormat.getInstance(); format.setMinimumFractionDigits(3); format.setMaximumFractionDigits(3); format.setGroupingUsed(false); return format.format(myNumber); } }