title: Certain BigDecimal numbers in Java when divided causes the ArithmeticException to be thrown
body: <p>The following approach to divide two <code>BegDecimal</code> numbers works fine.</p>
  
  <pre><code>BigDecimal a=new BigDecimal(5);
  BigDecimal b=new BigDecimal(2);
  System.out.println(a.divide(b));
  </code></pre>
  
  <p>Output : <code>2.5</code></p>
  
  <hr>
  
  <p>The following same approach however fails with the <code>java.lang.ArithmeticException</code></p>
  
  <pre><code>BigDecimal c=new BigDecimal(361);
  BigDecimal d=new BigDecimal(6);
  System.out.println(c.divide(d));
  </code></pre>
  
  <p>The following is the complete exception stack trace.</p>
  
  <pre><code>Exception in thread "main" java.lang.ArithmeticException:
  Non-terminating decimal expansion; no exact representable decimal result.
      at java.math.BigDecimal.divide(BigDecimal.java:1603)
      at currenttime.Main.main(Main.java:15)
  Java Result: 1
  </code></pre>
  
  <p>What's the solution?</p>