FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-programs/Cmdline_Sorting/cmd_sorting.java at main · IntScription/java-programs · GitHub
IntScription
/
java-programs
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-programs
/
Cmdline_Sorting
/
cmd_sorting.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (26 loc) · 894 Bytes
Breadcrumbs
java-programs
/
Cmdline_Sorting
/
cmd_sorting.java
Copy path
File metadata and controls
31 lines (26 loc) · 894 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
20
21
22
23
24
25
26
27
28
29
30
31
/* Reading the array of numbers through command line and sort in ascending order */
package
Cmdline_Sorting
;
public
class
cmd_sorting
{
public
static
void
main
(
String
[]
args
){
int
[]
a
=
new
int
[
10
];
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++) {
a
[
i
] =
Integer
.
parseInt
(
args
[
i
]);
}
System
.
out
.
println
(
"array before sorting: "
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++){
System
.
out
.
print
(
a
[
i
]);
}
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++) {
for
(
int
k
=
i
+
1
;
k
<
args
.
length
;
k
++) {
if
(
a
[
i
] >
a
[
k
]) {
int
temp
=
a
[
i
];
a
[
i
] =
a
[
k
];
a
[
k
] =
temp
;
}
}
}
System
.
out
.
println
(
"array after sorting: "
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
System
.
out
.
print
(
a
[
i
]);
}
}
Back
|
FazBrowse Home
|
New Git URL