从Array创建多个图像

时间:2015-06-18 13:45:04

标签: java arrays loops

我有一个点坐标数组。数据太大,不允许我创建一个BufferedImage,所以我想要以下内容。

要创建第一个BufferedImage,请先取100条第一行。然后循环再次启动,但是创建一个新的BufferedImage,其行数从101到200 ......执行此操作直到循环到达数组的末尾。

int temp = 100;

while (listPing.size() < temp) {
  // Do something
  // Create BufferedImage
  temp = temp * 2;
}

我该怎么做?

1 个答案:

答案 0 :(得分:0)

我不太清楚我是否明白你的意思,但我认为你所寻找的方式如下:

int total = listPing.size(); //calculate the total number lines in here
int temp = 100; //stepsize
int actualValue = 0;

while(actualValue < total) {
    Do something
    Create BufferedImage
    actualValue += temp;
}

另一种可能性是通过划分总大小/步长,然后创建for循环来预先计算你经历的次数。