title: How to compute logarithms in Java?
body: <p>Following is the formula</p>
  
  <p>Percentage of Fat = 495 / (1.0324 - 0.19077 x (LOG10(waist - neck)) + 0.15456 x (LOG10(height))) - 450</p>
  
  <p>Following is my code</p>
  
  <pre><code>import java.math.*;
  
  public class Position
  {
      static double waist=66,neck=30,height=150;
  
      public static void main(String[]args)
      {
          double fat = 495 / ( (1.0324 - 0.19077)* (Math.log(waist - neck)/Math.log(10)) + (0.15456) *  (Math.log(height)/Math.log(10))) - 450;
  
          System.out.println(fat);
      }
  }
  </code></pre>
  
  <p>The answer I get is incorrect. It should be 11.8% (Use the following <a href="http://lowcarbdiets.about.com/library/blbodyfatcalculator.htm" rel="nofollow">http://lowcarbdiets.about.com/library/blbodyfatcalculator.htm</a> )</p>
  
  <p>I believe I have done something incorrectly in logarithms. Please help me to get the correct answer. </p>