How can I increase image size by zero padding? For increasing the image size from 8X8 to 32X32, I tried to do zero padding. The simplest concept of zero padding in Java for me seems to be the code as shown below in Java such that I can shift each point by 4 points while rescaling.

for (int i = 0; i &lt; imageWidth; i += 4) 
        for (int j = 0; j &lt; imageHeight; j += 4) 
            pspectrum[i][j] = powerspectrum[(i + 1)/4][(j + 1)/4];


Now, what I am mainly concerned is that is there any more accurate method and how this helps with my calculation.
I suppose the array names are not descriptive of the contents and you have simply repurposed them. To zero-pad from 8x8 to 32x32:

for (int i = 0; i &lt; 32; i++) 
    for (int j = 0; j &lt; 32; j++) 
        pspectrum[i][j] = 0;
for (int i = 0; i &lt; 8; i++) 
    for (int j = 0; j &lt; 8; j++) 
        pspectrum[i][j] = powerspectrum[i][j];


The purpose of this is that the discrete Fourier transform (DFT) of a larger image has a higher frequency resolution, so you can resolve for example the dominant frequency more accurately. It is the same as really well done interpolation in the frequency domain.