title: How to figure out which value is 0?
body: <p>I got my 1st crash report for my app. It says there is a <code>java.lang.ArithmeticException: divide by zero</code></p>
  
  <p>The exception is on one of these two lines: </p>
  
  <pre><code>//sWP stands for "Screen Width in Pixels"
  // sW stands for "Screen Width" The code is old though, so I may be incorrect for both variables.
  //res is just getResources()
  int sWP = sW / (res.getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT);
  float bHeight = 50 * ((float)res.getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT);
  </code></pre>
  
  <p>Can <code>DisplayMetrics.DENSITY_DEFAULT</code> ever be zero? Or can <code>getDisplayMetrics().densityDpi</code> ever be zero? </p>