()
| 175 | } |
| 176 | |
| 177 | @Override |
| 178 | public double median() |
| 179 | { |
| 180 | double[] copy = Arrays.copyOfRange(array, startIndex, endIndex); |
| 181 | |
| 182 | Arrays.sort(copy); |
| 183 | |
| 184 | if(copy.length % 2 == 1) |
| 185 | return copy[copy.length/2]; |
| 186 | else |
| 187 | return copy[copy.length/2]/2+copy[copy.length/2+1]/2;//Divisions by 2 then add is more numericaly stable |
| 188 | } |
| 189 | |
| 190 | @Override |
| 191 | public double skewness() |