test implementation of classes with autoboxing
This commit is contained in:
@@ -2,4 +2,23 @@ package Sorting;
|
||||
|
||||
public class BubbleSorter extends Sorter{
|
||||
//a class to sort arrays of numbers using bubble sort
|
||||
|
||||
public BubbleSorter(String filename){
|
||||
super(filename);
|
||||
}
|
||||
|
||||
void sort(){
|
||||
|
||||
boolean usedSwap;
|
||||
do{
|
||||
usedSwap=false;
|
||||
for(int i=0;i<numbers.length-1;i++){
|
||||
if(compare(numbers[i],numbers[i+1])>0){
|
||||
swap(numbers[i],numbers[i+1]);
|
||||
usedSwap=true;
|
||||
}
|
||||
}
|
||||
}while(usedSwap);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user