Code example for BigDecimal

Methods: compareTo

0
	} 
	public DoubleHolder(final double held,final int scale){
		this.held = createBigDecimal(held,scale);
	} 
	public int compareTo(final DoubleHolder other) {
		return held.compareTo(other.held); 
	} 
	public BigDecimal getBigDecimal(final double d1,final int scale) {
		return createBigDecimal(d1, scale);
	} 
	 
	private BigDecimal createBigDecimal(final double d1, final int scale){
		BigDecimal bd1 = new BigDecimal(d1);
		bd1 = bd1.setScale(scale, BigDecimal.ROUND_HALF_UP);
		return bd1;
	} 
	public boolean equals(final Object o){
		if (!(o instanceof DoubleHolder)){
			return false;  
		} 
		return compareTo(((DoubleHolder)o)) == 0;