FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java2python/test/Format1.java at master · kurtli/java2python · GitHub
kurtli
/
java2python
Public
forked from
natural/java2python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java2python
/
test
/
Format1.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (16 loc) · 716 Bytes
Breadcrumbs
java2python
/
test
/
Format1.java
Copy path
File metadata and controls
19 lines (16 loc) · 716 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public
class
Format1
{
public
static
void
main
(
String
[]
args
) {
long
n
=
461012
;
String
f1
=
String
.
format
(
"%d%n"
,
n
);
// --> "461012"
String
f2
=
String
.
format
(
"%08d%n"
,
n
);
// --> "00461012"
String
f3
=
String
.
format
(
"%+8d%n"
,
n
);
// --> " +461012"
String
f4
=
String
.
format
(
"%,8d%n"
,
n
);
// --> " 461,012"
String
f5
=
String
.
format
(
"%+,8d%n"
,
n
);
// --> "+461,012"
System
.
out
.
println
(
f1
+
f2
+
f3
+
f4
+
f5
);
double
pi
=
3.14159265
;
String
pf1
=
String
.
format
(
"%f%n"
,
pi
);
// --> "3.141593"
String
pf2
=
String
.
format
(
"%.3f%n"
,
pi
);
// --> "3.142"
String
pf3
=
String
.
format
(
"%10.3f%n"
,
pi
);
// --> " 3.142"
System
.
out
.
println
(
pf1
+
pf2
+
pf3
);
}
}
Back
|
FazBrowse Home
|
New Git URL