Added the Symbol With value.
public class Test2 { public static void main(String[] args) { String value2="123.1234"; String leftPadSymbol=leftPaddingWithsymblo(value2, defaultLength); System.out.println(leftPadSymbol); } private static String leftPaddingWithsymblo(String value2, int defaultLength) { String formattedValue=""; try { DecimalFormat decimalFormat = new DecimalFormat("$ #.00"); Double douNum = Double.parseDouble(value2); formattedValue = String.format(decimalFormat.format(douNum)); System.out.println(formattedValue); }catch (Exception e) { e.printStackTrace(); } return formattedValue; } }Output of the Above Program
$ 123.12