It's been a long time since I did any signal processing but you might want to try doing a simple zero-crossing count.
For example, count the number of times the signal goes from negative to positive and divide by the number of samples.
int crossings = 0;
for(int idx = 1; idx < sample.length; idx++)
{
if((sample[idx - 1] < 0) && (sample[idx] >= 0))
{
crossings++;
}
}
int frequency = (crossings * sampleRate) / sample.length;
You can doubtlessly get even more complex but this may be good enough for reasonably clean signals.
Hope this helps.
Indeed - zero-crossings will give you the "average" frequency rather than the dominant one.
As suggested, use a fourier transform to get the spectrum corresponding to your signal. The dominant frequency is the one with the highest response.
You might be able to get hold of an FFT routine from mathtools.net or alternatively just wrap up the one listed here:
http://www.nauticom.net/www/jdtaft/JavaFFT.htm
Hope this helps.