public synchronized float[] getConfidenceLevelInterval(float coverage)
    {
        if (coverage < 1e-3 || 1. < coverage)
            throw new IllegalArgumentException("require 0 < coverage < 1"); 
        float[] CLInterval = new float[2];
        //first element is lower bound
        //second element is upper bound
        
        float totalWeight = 0;
        for (int i=0;i < nBins; i++)
            totalWeight += binYval(i);

        if (totalWeight < 1.e-9)
            return CLInterval;

        float targetWeight = (1.f - coverage) /2.f;

        float weight = 0;
        for (int i=0;i < nBins; i++)
            if ((weight += binYval(i)) >= targetWeight)
            {
                CLInterval[0] = binXval(i);
                break;
            }

        weight = 0; 
        for (int i=nBins-1;i >=0 ; i--)
            if ((weight += binYval(i)) >= targetWeight)
            {
                CLInterval[1] = binXval(i);
                break;
            }

        return CLInterval;
    }