How to Sense the spectrum bycomparing calculated energy with threshold

hi,i am working on the project spectrum sensing by using energy
detection. first i insert a block of usrp then i insert the block of
stream to vector ,then i have taken fft of that and then i have taken
the magnitude square block.i yhs way i calaculte i have to
compare this energy with predetermined what is easier way
to compare energy with threshold in order to sense the spectrum