How to analyze audio input/spectrum correctly
Let's see. I have no idea about Java classes or what type of support it has for signal processing, but i will give you some guidelines. The Particular details of the implementation in the language, you have to figure out.

To do any kind of processing on an audio file you need the "raw" data, meaning an audio file wich has uncompressed audio samples. For exmaple, the WAV format, which normally has samples in 16bit signed 2's complement.

If you are going to use a computer and do offline processing, might be a good idea to cast that value to a double (Which in most processors today means 64bit floating point number).

Therefore you will have a continuos stream of double numbers coming from the file. Then you need to define a way to handle the continous data. A standard, very widely used way is to use a circular buffer (even if it is offline, i assume you want your code to be efficient, and loading the entire file to memory as an array is not the best solution). Either that or just a normal buffer, is your choice. The buffer length should be a power of 2 (Do to efficiency of the Cooley-Tukey radix-2 algorithm).

Now you need to do the actual FFT. This is merely a multiplicacion of the buffer (Which mathematically is a vector) by the FFT matrix. How this operation is actually performed in Java, no idea. In C it would be just to pass the pointer to the array and the length to an FFT routine that, either returns a pointer to dinamically allocated memory, or leaves the result in an array that you pass to it.

finally, you arrive at an array of M complex numbers (Assuming the length of the array/buffer/vector with the signal is M). And then you do whatever you want with it.

For instance, you could take the magnitude of each of the complex numbers, and find the maximum, to detect where the fundamental frequency could be (very approximate though).

Extras:
More advanced techniques to process would include a pre windowing to avoid leakeage, doing zero-padding to obtain more resolution on the windowed spectrum, etc.

Hope it Helps.