Code example for BigDecimal

Methods: divide

0
public BigDecimal decimalValue(){
	return decimalValue(MathContext.UNLIMITED);
} 
 
public BigDecimal decimalValue(MathContext mc){
	BigDecimal numerator = new BigDecimal(this.numerator);
	BigDecimal denominator = new BigDecimal(this.denominator);
 
	return numerator.divide(denominator, mc);
} 
 
public BigInteger bigIntegerValue(){
	return numerator.divide(denominator);
} 
 
public int compareTo(Object o){
	Number other = (Number)o;
	return Numbers.compare(this, other);
} 
}