Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Cat[] sort(Cat[] array){
- Cat[] mass = array;
- Cat buffer = null;
- Cat current = null;
- for (int i = 0; i < mass.length; i++) {
- current = mass[i];
- for (int j = i; j < mass.length; j++) {
- if(current.compareTo(mass[j]) > 1){
- buffer = current;
- current = mass[j];
- mass[j] = buffer;
- }
- }
- }
- return mass;
- }
- public static Dog[] sort1(Dog[] array){
- Dog[] mass = array;
- Dog buffer = null;
- Dog current = null;
- for (int i = 0; i < mass.length; i++) {
- current = mass[i];
- for (int j = i; j < mass.length; j++) {
- if(current.compareTo(mass[j]) > 1){
- buffer = current;
- current = mass[j];
- mass[j] = buffer;
- }
- }
- }
- return mass;
- }
Add Comment
Please, Sign In to add comment