FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/BubbleSort.java at main · Eggy115/Java · GitHub
Eggy115
/
Java
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
5
Star
3
Code
Issues
0
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
BubbleSort.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (21 loc) · 696 Bytes
Breadcrumbs
Java
/
BubbleSort.java
Copy path
File metadata and controls
23 lines (21 loc) · 696 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
import
java
.
util
.
Arrays
;
public
class
BubbleSort
{
public
static
void
main
(
String
[]
args
) {
int
[]
arr
= {
38
,
27
,
43
,
3
,
9
,
82
,
10
};
System
.
out
.
println
(
"Unsorted array: "
+
Arrays
.
toString
(
arr
));
bubbleSort
(
arr
);
System
.
out
.
println
(
"Sorted array: "
+
Arrays
.
toString
(
arr
));
}
public
static
void
bubbleSort
(
int
[]
arr
) {
int
n
=
arr
.
length
;
for
(
int
i
=
0
;
i
<
n
-
1
;
i
++) {
for
(
int
j
=
0
;
j
<
n
-
i
-
1
;
j
++) {
if
(
arr
[
j
] >
arr
[
j
+
1
]) {
int
temp
=
arr
[
j
];
arr
[
j
] =
arr
[
j
+
1
];
arr
[
j
+
1
] =
temp
;
}
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL