/** * @author Ing. František Kučera (frantovo.cz) */ public class Test { public static void main(String[] args) { long start = System.currentTimeMillis(); int width = 1600; int height = 1200; int nwidth = width * 2; int nheight = height * 2; double[] data = new double[width * height]; double[] newdata = new double[nwidth * nheight]; double[] someval = new double[]{0, 0, 0, 0.4, 1, 1.1, 8}; int it = 0; int size = width * height; for (int i = 0; i < size; i++) { data[i] = someval[it++ % 7]; } for (int y = 0; y < height - 1; y++) { for (int x = 0; x < width - 1; x++) { int nx = x * 2; int ny = y * 2; newdata[ny * nwidth + nx] = data[y * width + x]; newdata[ny * nwidth + nx + 1] = (data[y * width + x] + data[y * width + x + 1]) / 2.0; newdata[(ny + 1) * nwidth + nx] = (data[y * width + x] + data[(y + 1) * width + x]) / 2.0; newdata[(ny + 1) * nwidth + nx + 1] = (data[y * width + x] + data[y * width + x + 1] + data[(y + 1) * width + x] + data[(y + 1) * width + x + 1]) / 4.0; //System.out.print("x"); } //System.out.print("y"); } System.out.println("Čas: " + (System.currentTimeMillis() - start) + " ms"); } }