@Override
    public boolean load() {
        int x, y;
        int calderaX, calderaY;
        int sx, sy;
        int tx, ty;
        int m;
        float calderaStartPoint;
        float cutoff;
        int dx[] = {0, 1, 0, size - 1, 1, 1, size - 1, size - 1};
        int dy[] = {1, 0, size - 1, 0, size - 1, 1, size - 1, 1};
        float[][] tempBuffer = new float[size][size];
        //map 0 unmarked, unvisited, 1 marked, unvisited, 2 marked visited.
        int[][] calderaMap = new int[size][size];
        boolean done;


        int minx, maxx;
        int miny, maxy;


        if (null != heightData) {
            unloadHeightMap();
        }


        heightData = new float[size * size];


        //create peaks.
        for (int i = 0; i < jumps; i++) {


            //pick a random point.
            x = (int) (Math.rint(Math.random() * (size - 1)));
            y = (int) (Math.rint(Math.random() * (size - 1)));


            //set the caldera point.
            calderaX = x;
            calderaY = y;


            int numberParticles =
                    (int) (Math.rint(
                    (Math.random() * (maxParticles - minParticles))
                    + minParticles));
            //drop particles.
            for (int j = 0; j < numberParticles; j++) {
                //check to see if we should agitate the drop point.
                if (peakWalk != 0 && j % peakWalk == 0) {
                    m = (int) (Math.rint(Math.random() * 7));
                    x = (x + dx[m] + size) % size;
                    y = (y + dy[m] + size) % size;
                }


                //add the particle to the point.
                tempBuffer[x][y] += 1;


                sx = x;
                sy = y;
                done = false;


                //cause the particle to "slide" down the slope and settle at
                //a low point.
                while (!done) {
                    done = true;


                    //check neighbors to see if we are higher.
                    m = (int) (Math.rint((Math.random() * 8)));
                    for (int jj = 0; jj < 8; jj++) {
                        tx = (sx + dx[(jj + m) % 8]) % (size);
                        ty = (sy + dy[(jj + m) % 8]) % (size);


                        //move to the neighbor.
                        if (tempBuffer[tx][ty] + 1.0f < tempBuffer[sx][sy]) {
                            tempBuffer[tx][ty] += 1.0f;
                            tempBuffer[sx][sy] -= 1.0f;
                            sx = tx;
                            sy = ty;
                            done = false;
                            break;
                        }
                    }
                }


                //This point is higher than the current caldera point,
                //so move the caldera here.
                if (tempBuffer[sx][sy] > tempBuffer[calderaX][calderaY]) {
                    calderaX = sx;
                    calderaY = sy;
                }
            }


            //apply the caldera.
            calderaStartPoint = tempBuffer[calderaX][calderaY];
            cutoff = calderaStartPoint * (1.0f - caldera);
            minx = calderaX;
            maxx = calderaX;
            miny = calderaY;
            maxy = calderaY;


            calderaMap[calderaX][calderaY] = 1;


            done = false;
            while (!done) {
                done = true;
                sx = minx;
                sy = miny;
                tx = maxx;
                ty = maxy;


                for (x = sx; x <= tx; x++) {
                    for (y = sy; y <= ty; y++) {


                        calderaX = (x + size) % size;
                        calderaY = (y + size) % size;


                        if (calderaMap[calderaX][calderaY] == 1) {
                            calderaMap[calderaX][calderaY] = 2;


                            if (tempBuffer[calderaX][calderaY] > cutoff
                                    && tempBuffer[calderaX][calderaY]
                                    <= calderaStartPoint) {


                                done = false;
                                tempBuffer[calderaX][calderaY] =
                                        2 * cutoff - tempBuffer[calderaX][calderaY];


                                //check the left and right neighbors
                                calderaX = (calderaX + 1) % size;
                                if (calderaMap[calderaX][calderaY] == 0) {
                                    if (x + 1 > maxx) {
                                        maxx = x + 1;
                                    }
                                    calderaMap[calderaX][calderaY] = 1;
                                }


                                calderaX = (calderaX + size - 2) % size;
                                if (calderaMap[calderaX][calderaY] == 0) {
                                    if (x - 1 < minx) {
                                        minx = x - 1;
                                    }
                                    calderaMap[calderaX][calderaY] = 1;
                                }


                                //check the upper and lower neighbors.
                                calderaX = (x + size) % size;
                                calderaY = (calderaY + 1) % size;
                                if (calderaMap[calderaX][calderaY] == 0) {
                                    if (y + 1 > maxy) {
                                        maxy = y + 1;
                                    }
                                    calderaMap[calderaX][calderaY] = 1;
                                }
                                calderaY = (calderaY + size - 2) % size;
                                if (calderaMap[calderaX][calderaY] == 0) {
                                    if (y - 1 < miny) {
                                        miny = y - 1;
                                    }
                                    calderaMap[calderaX][calderaY] = 1;
                                }
                            }
                        }
                    }
                }
            }
        }

        //transfer the new terrain into the height map.
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                setHeightAtPoint(tempBuffer[i][j], j, i);
            }
        }
        erodeTerrain();
        normalizeTerrain(NORMALIZE_RANGE);

        logger.fine("Created heightmap using Particle Deposition");

        return true; // success
    }
<code>load</code> generates the heightfield using the Particle Deposition
algorithm. <code>load</code> uses the latest attributes, so a call
to <code>load</code> is recommended if attributes have changed using
the set methods.
jme3-terrain/src/main/java/com/jme3/terrain/heightmap/ParticleDepositionHeightMap.java