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
22 lines (20 loc) · 820 Bytes
/
Copy pathBubbleSort.java
File metadata and controls
22 lines (20 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
publicclassBubbleSort{
publicstaticvoidmain(String[] args){
intnumberArray[] = newint[args.length];
for(inti=0; i<args.length;i++){
numberArray[i] = Integer.parseInt(args[i]);
}
for(inti=0; i<numberArray.length; i++){
for(intj=0;j<numberArray.length;j++){
if(numberArray[i]<numberArray[j]){
numberArray[i] = numberArray[i]*numberArray[j];
numberArray[j] = numberArray[i]/numberArray[j];
numberArray[i] = numberArray[i]/numberArray[j];
}
}
}
for(inti=0; i<numberArray.length; i++){
System.out.println(numberArray[i]);
}
}
}