Hi everybody!

The following code throws an exception if x > 160

package test;
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
public class Test {
        public static void main(String[] strings) {
                int x = 161; // 160 works
                DescriptiveStatistics descriptiveStatistics = new
DescriptiveStatistics(100);
                for (int i = 0; i < x; i++) descriptiveStatistics.addValue(1.2);
                descriptiveStatistics.clear();
                descriptiveStatistics.addValue(1.2);
        }
}


Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 32
        at
org.apache.commons.math.util.ResizableDoubleArray.addElement(ResizableDoubleArray.java:255)
        at
org.apache.commons.math.stat.descriptive.DescriptiveStatistics.addValue(DescriptiveStatistics.java:168)
        at test.Test.main(Test.java:11)

Am I missing anything?
Thanks!
Alex

-- 
View this message in context: 
http://www.nabble.com/DescriptiveStatistics%3A-addValue-throws-exception-after-clear-tp24577692p24577692.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to