blob: 612fbcf2883ad259711ff3ffaa6d27ff532b098f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* Listing1708.java */
import java.text.*;
public class Listing1708
{
public static void print(double value, String format)
{
DecimalFormat df = new DecimalFormat(format);
System.out.println(df.format(value));
}
public static void main(String[] args)
{
double value = 1768.3518;
print(value, "#0.0");
print(value, "#0.000");
print(value, "000000.000");
print(value, "#.000000");
print(value, "#,###,##0.000");
print(value, "0.000E00");
}
}
|