forked from bliblidotcom/training-java-future-program
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBubbleSort.java
More file actions
Latest commit
30 lines (23 loc) · 501 Bytes
/
Copy pathBubbleSort.java
File metadata and controls
30 lines (23 loc) · 501 Bytes
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
publicclassBubbleSort{
publicstaticvoidmain(String[] args){
inttotal= args.length;
intangka[],temp;
angka= newint[100];
for(inti=0;i<total;i++){
angka[i]= Integer.parseInt(args[i]);
}
for(inti=0;i<total;i++){
for(intj=0; j<total-i-1;j++){
if(angka[j]>angka[j+1]){
temp = angka[j];
angka[j] = angka[j+1];
angka[j+1] = temp;
}
}
}
for(inti=0;i<total;i++){
System.out.println(angka[i]);
}
}
}
//kecil ke besar