Guest User

Untitled

a guest
Oct 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public static Cat[] sort(Cat[] array){
  2. Cat[] mass = array;
  3. Cat buffer = null;
  4. Cat current = null;
  5. for (int i = 0; i < mass.length; i++) {
  6. current = mass[i];
  7. for (int j = i; j < mass.length; j++) {
  8. if(current.compareTo(mass[j]) > 1){
  9. buffer = current;
  10. current = mass[j];
  11. mass[j] = buffer;
  12. }
  13. }
  14. }
  15. return mass;
  16. }
  17.  
  18. public static Dog[] sort1(Dog[] array){
  19. Dog[] mass = array;
  20. Dog buffer = null;
  21. Dog current = null;
  22. for (int i = 0; i < mass.length; i++) {
  23. current = mass[i];
  24. for (int j = i; j < mass.length; j++) {
  25. if(current.compareTo(mass[j]) > 1){
  26. buffer = current;
  27. current = mass[j];
  28. mass[j] = buffer;
  29. }
  30. }
  31. }
  32. return mass;
  33. }
Add Comment
Please, Sign In to add comment