-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConversion.java
More file actions
50 lines (44 loc) · 1.44 KB
/
Copy pathConversion.java
File metadata and controls
50 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.math.*;
import java.util.*;
public class Conversion{
public static void main(String[] args){
Formatter f = new Formatter(System.out);
char u = 'a';
System.out.println("u = 'a'");
f.format("s: %s\n", u);
f.format("c: %c\n", u);
f.format("b: %b\n", u);
f.format("h: %h\n", u);
int v = 121;
f.format("d: %d\n", v);
f.format("c: %c\n", v);
f.format("b: %b\n", v);
f.format("s: %s\n", v);
f.format("x: %x\n", v);
f.format("h: %h\n", v);
BigInteger w = new BigInteger("500000000000000");
System.out.println("w = new BigInteger(\"500000000000000\")");
f.format("d: %d\n", w);
f.format("b: %b\n", w);
f.format("s: %s\n", w);
f.format("x: %x\n", w);
f.format("h: %h\n", w);
double x = 179.543;
System.out.println("x = 179.543");
f.format("b: %b\n", x);
f.format("s: %s\n", x);
f.format("f: %f\n", x);
f.format("e: %e\n", x);
f.format("h: %h\n", x);
Conversion y = new Conversion();
System.out.println("y = new Conversion()");
f.format("b: %b\n", y);
f.format("s: %s\n", y);
f.format("h: %h\n", y);
boolean z = false;
System.out.println("z = false");
f.format("b: %b\n", z);
f.format("s: %s\n", z);
f.format("h: %h\n", z);
}
}