# BigDecimal code critique

I'm teaching myself BigDecimal and would appreciate a critique. In the code fragment below, I calculate a tip from user input: check and tip percentage (entered as integer):

 txt_check = txtcheck.getText().toString();
tpercent = txttippct.getText().toString();

BigDecimal hundred = new BigDecimal("100");
BigDecimal pct = new BigDecimal(tpercent);

BigDecimal bdpercent = pct.divide(hundred, 2,BigDecimal.ROUND_UNNECESSARY);
BigDecimal bdcheck = new BigDecimal(txt_check);
BigDecimal bdtip = new BigDecimal(txt_check);
bdtip = bdtip.multiply(bdpercent);
BigDecimal bdtotal = new BigDecimal(txt_check);


The code above appears to function correctly. To display these values I convert to string:

 scheck = new DecimalFormat("####.00").format(bdcheck.doubleValue());


Thanks for any input.

For such a simple calculation, the logic used for the bdtip and bdtotal variables wasnt straight forward. Instead of creating it with the value of one of the operands, then multiplying/adding it by the other operand, why not do something like the following:

txt_check = txtcheck.getText().toString();
tpercent = txttippct.getText().toString();

BigDecimal hundred = new BigDecimal("100");
BigDecimal pct = new BigDecimal(tpercent);

BigDecimal bdpercent = pct.divide(hundred, 2, BigDecimal.ROUND_UNNECESSARY);
BigDecimal bdcheck = new BigDecimal(txt_check);

BigDecimal bdtip = bdcheck.mulitply(bdpercent);

2. new BigDecimal("100") could be a constant.
3. DecimalFormat.format(Object number, StringBuffer toAppendTo, FieldPosition pos) accepts BigDecimal objects (without the necessity of converting it to double and loss of precision).