niyaznigmatullin

Untitled

Apr 18th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. import java.util.Comparator;
  2.  
  3. public class Sorting {
  4.     static void sort(Object[] a, Comparator<Object> c) {
  5.         for (int i = 0; i < a.length; i++) {
  6.             for (int j = i + 1; j < a.length; j++) {
  7.                 if (c.compare(a[i], a[j]) > 0) {
  8.                     Object t = a[i];
  9.                     a[i] = a[j];
  10.                     a[j] = t;
  11.                 }
  12.             }
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment