Cross Correlation in Java (Android) Using FFT (Frequency Domain Convolution / Correlation)
If index k refer to the highest correlation coeffitient and let n be the length of each x and y, so would n-k be the lag for y at maxima of the correlation function. 

For some applications I prefer the cosine similarity instead of plain correlation, but which is less efficient in calculation.