class FrequencyToPitchConversion {

    public String getPitchName(float freq){

        float closestDistance = 9999999f;
        PitchFreq bestMatch = null;

        for(PitchFreq pitchFreq:pitchFreqs) {

            int numOfOctaves = 8;
            for (int i = 0; i < numOfOctaves+1; i++) {

                double freqOctave = pitchFreq.getFreq() * Math.pow((double)2f,(double)i);

                if(Math.abs(freq-freqOctave) < closestDistance){
                    bestMatch = pitchFreq;
                    bestMatch.setOctave(i);
                    closestDistance = (float)Math.abs(freq-freqOctave);
                }
            }
        }

        return bestMatch.getNote();
    }

    public  FrequencyToPitchConversion();

}