title: Getting the percentage of two numbers to the nearest tenth in Java
body: <p>I am trying to get the nearest percent of two numbers in java, but it is not working.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>DecimalFormat df = new DecimalFormat("0.0");
  double PD1 = (minus1 / MaxInt) * 100;
  P1 = String.valueOf(df.format(PD1));
  </code></pre>
  
  <p>MaxInt is number possible, minus1 is MaxInt - 1 and then I multiply it by 100 to get the percentage and then the decimal format is suppose to round it to one decimal place, but it keeps returning a zero.   </p>