title: How can I divide properly using BigDecimal
body: <p>My code sample:</p>
  
  <pre><code>import java.math.*; 
  
  public class x
  {
    public static void main(String[] args)
    {
      BigDecimal a = new BigDecimal("1");
      BigDecimal b = new BigDecimal("3");
      BigDecimal c = a.divide(b, BigDecimal.ROUND_HALF_UP);
      System.out.println(a+"/"+b+" = "+c);
    }
  }
  </code></pre>
  
  <p>The result is:
  <code>1/3 = 0</code></p>
  
  <p>What am I doing wrong?</p>