1
2package org.arpit.java2blog;
3
4public class StringFromatformatDouble {
5
6 public static void main(String[] args) {
7 double d = 2.456534;
8 System.out.println("Double upto 2 decimal places: "+String.format("%.2f",d));
9 }
10}
11
12
1String pattern = "###,###.###";
2DecimalFormat decimalFormat = new DecimalFormat(pattern);
3