Code example for BigDecimal

Methods: compareTo

	public int compareTo(Object o) {
		if (o instanceof MonetaryAmount) {
			// TODO: This would actually require some currency conversion magic 
			return this.getValue().compareTo(((MonetaryAmount) o).getValue());
		return 0; 
	// ********************** Business Methods ********************** // 
	public static MonetaryAmount fromString(String amount, String currencyCode) {
		return new MonetaryAmount(new BigDecimal(amount),
	public static MonetaryAmount convert(MonetaryAmount amount,
										 Currency toConcurrency) {
		// TODO: This requires some conversion magic and is therefore broken 
Connect your IDE to all the code out there  Get Codota for Java