Advertisement
cd62131

Sort Arrays

Jan 27th, 2014
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.52 KB | None | 0 0
  1. import java.util.Arrays;
  2.  
  3. public class Median {
  4.   public static void main(String[] args) {
  5.     int a = 2;
  6.     int b = 3;
  7.     int c = 5;
  8.     int d = 7;
  9.     int e = 11;
  10.     int v[] = new int[10];
  11.     v[0] = a * b;
  12.     v[1] = a * c;
  13.     v[2] = a * d;
  14.     v[3] = a * e;
  15.     v[4] = b * c;
  16.     v[5] = b * d;
  17.     v[6] = b * e;
  18.     v[7] = c * d;
  19.     v[8] = c * e;
  20.     v[9] = d * e;
  21.     Arrays.sort(v);
  22.     System.out.println(Arrays.toString(v));
  23.     System.out.println(v[(10 - 1) / 2] + ", " + v[10 / 2]);
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement