how to fill array list between 2 points?

試著忘記壹切 提交于 2019-12-02 10:10:51

You got your for-loops wrong. Use the following ones and you should be fine:

 for (int i=0;i<=10;i++){ 
     x.add(ttime / 10.0 * i);
 } 

 for (int i=0;i<=10;i++){ 
     y.add(initcores + ((fcores - initcores) / 10 * i)); 
 } 

These loops will give you 11 points, but you can adjust them to your needs.

Update

You naturally have to use the correct values from the list. Make sure that both lists have same length.

ArrayList<Double> x = new ArrayList<Double>(); 
ArrayList<Double> y = new ArrayList<Double>(); 

... above code ...

TimeSeries series = new TimeSeries("Number of cores");
for (int i=0;i<x.size();i++){
    series.add(x.get(i),y.get(i));
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!