public void normalizeTerrain(float value) {
        float currentMin, currentMax;
        float height;

        currentMin = heightData[0][0];
        currentMax = heightData[0][0];

        //find the min/max values of the height fTemptemptempBuffer
        for (int i = 0; i < imageHeight; i++) {
            for (int j = 0; j < imageWidth; j++) {
                if (heightData[i][j] > currentMax) {
                    currentMax = heightData[i][j];
                } else if (heightData[i][j] < currentMin) {
                    currentMin = heightData[i][j];
                }
            }
        }

        //find the range of the altitude
        if (currentMax <= currentMin) {
            return;
        }

        height = currentMax - currentMin;

        //scale the values to a range of 0-255
        for (int i = 0; i < imageHeight; i++) {
            for (int j = 0; j < imageWidth; j++) {
                heightData[i][j] = ((heightData[i][j] - currentMin) / height) * value;
            }
        }
    }