Code example for BigDecimal

Methods: divide

0
	 *  
	 * @param priceInCents valor em string e em centesimos. Ex: 2050=20.50 
	 * @return 
	 */ 
	public BigDecimal stringInCentsToBigDecimal(String priceInCents) {	
		return new BigDecimal(priceInCents).divide(new BigDecimal(100)).setScale(SCALE,
				ROUNDING_MODE);
	} 
	 
	public String bigDecimalToStringInCents(BigDecimal value){
		return String.format("%.0f", value.multiply(new BigDecimal(100)));
	} 
	 
	/** 
	 *  
	 * @param valor 
	 * @return retorna o BigDecimal normalizado com scale=2 e RoundingMode=HALF_EVEN 
	 */ 
	public BigDecimal normalizaBigDecimal(BigDecimal valor){
		return valor.setScale(SCALE,ROUNDING_MODE);
Connect your IDE to all the code out there  Get Codota for Java