int array[][][] = new short[d][w][h];
fill(array);
for (int i=0; i<d; i++)
{
BufferedImage image = new BufferedImage(w,h,BufferedImage.TYPE_INT_ARGB);
for (int x=0; x<w; x++)
{
for (int y=0; y<h; y++)
{
int v = array[i][x][y];
int rgb = convert(v);
image.setRGB(x,y, rgb);
}
}
}
{
{
{1,2,3},{1,2,3}
},
{
{4,5,6},{4,5,6}
},
{
{7,8,9},{7,8,9}
}
}
private static int convert(short s)
{
float f = (float)s/Short.MAX_VALUE;
int b = (int)(b*255);
return getARGB(b,b,b,b);
}
private static int getARGB(int a, int r, int g, int b)
{
return (a << 24) | (r << 16) | (g << 8) | (b << 0);
}