public static float magnitudeToDb(float squareMag){
  if (squareMag == 0)   return 0;
  return (float)(20 * Math.log10(squareMag));
}

public static float magnitudeToDb ( float squareMag ) { if ( squareMag == 0 ) return 0 ; return ( float ) ( 20 * Math . log10 ( squareMag ) ) ; }
convert square of magnitude to decibels
