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
22 lines (20 loc) · 820 Bytes
/
BubbleSort.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
public class BubbleSort{
public static void main(String[] args){
int numberArray[] = new int[args.length];
for(int i=0; i<args.length;i++){
numberArray[i] = Integer.parseInt(args[i]);
}
for(int i=0; i<numberArray.length; i++){
for(int j=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(int i=0; i<numberArray.length; i++){
System.out.println(numberArray[i]);
}
}
}