static float linearToDB(float linear){
  float dB=(float)(Math.log((double)((linear == 0.0) ? 0.0001 : linear)) / Math.log(10.0) * 20.0);
  return dB;
}

static float linearToDB ( float linear ) { float dB = ( float ) ( Math . log ( ( double ) ( ( linear == 0.0 ) ? 0.0001 : linear ) ) / Math . log ( 10.0 ) * 20.0 ) ; return dB ; }
linear to db scale conversion .
