We show, that a three-dimensional array of dimension n1, n2, n3 can be rotated in such a way, that all the innermost loops have lengths, which are products of two dimensions, i.e. n1n2, n1n3, n2n3. This technique is then applied to rotate a parallelepiped of data in an optimal position for Fourier transformations along the three axes. The resulting three-dimensional FFT (fast Fourier transform) has then only inner loops of length n1n2, n1n3, n2n3. This increased loop length results in a significant reduction of the required CPU time on vector machines.