private long medianValue(long[] times){
  if (times.length == 0) {
    throw new IllegalArgumentException("Empty array");
  }
  Arrays.sort(times.clone());
  long median=times[times.length / 2];
  if (times.length > 1 && times.length % 2 != 0) {
    median=(median + times[times.length / 2 + 1]) / 2;
  }
  return median;
}

private long medianValue ( long [ ] times ) { if ( times . length == 0 ) { throw new IllegalArgumentException ( "Empty array" ) ; } Arrays . sort ( times . clone ( ) ) ; long median = times [ times . length / 2 ] ; if ( times . length > 1 && times . length % 2 != 0 ) { median = ( median + times [ times . length / 2 + 1 ] ) / 2 ; } return median ; }
calculates the median value of the array
