title: Losing precision when converting from inches to centimeter and vice versa
body: <p>I am actually loosing precision values when I convert from <code>Inches to Centimeter</code> and Again <code>Centimeter to Inches</code>. </p>
  
  <p>// Inches to Centimeter</p>
  
  <pre><code>public static String convertInchesToCentimeter(String inches) {
      double in = 0;
      try {
          if (inches != null &amp;&amp; inches.trim().length() != 0) { in = Double.parseDouble(inches) / 0.39370;
          }
      } catch (NumberFormatException nfx) {
          System.err.println("Invalid input.");
      }
      return String.valueOf( in );
  }
  </code></pre>
  
  <p>// Centimeter to Inches</p>
  
  <pre><code>public static double convertCentiToInch(double d) {
      double centiToInch = 0;
      if (String.valueOf(d) != null &amp;&amp; String.valueOf(d).trim().length() != 0) {
  
          centiToInch = d * 0.39;
      }
      return centiToInch;
  }
  </code></pre>
  
  <p>If i enter <code>45, its showing 44.58</code>. I don't know where the is the exact problem happening?</p>