code: public static double median(int[] values) {
          if (values.length == 0)
              throw new IllegalArgumentException("No median in an empty array");        
          int[] sorted = Arrays.copyOf(values, values.length);
          Arrays.sort(sorted);
          return sorted[sorted.length/2];
      }
docs: Returns the median value of the array of ints