@Override
	public double percentile(double percentile) {
		if (N == 0)
			return Double.NaN;
		// Number of values in the quartile
		double indexing = N * percentile;

		// If indexing has digits the index array contains only the number
		// indexing + 1. On the other hand, if indexing is an even number (it
		// has no decimals), index array contains two numbers: indexing and
		// indexing + 1
		int index[] = (indexing % 1 == 0) ? new int[] { (int) indexing,
				(int) indexing + 1 } : new int[] { (int) indexing + 1 };
		double sum = 0.0;
		for (int i : index)
			sum += getValue(i).doubleValue();
		return sum / index.length;
	}