I am trying to make a program in Java that uses Perlin noise to make a black and white height map. I tried using the code from here to implement the noise. I used the code below to try to make the noise make a height map but what I get is something like this instead of getting a height map.
BufferedImage img;
img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB );
int[] pixel = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
for(int i = 0; i < (WIDTH*HEIGHT); i++)
{
pixel[i] = (int) perlin.PerlinNoise(i, i);
}