Here you can find the source of adjustCurrencyDecimalPoint(final BigDecimal value, final int decimal)
Parameter | Description |
---|---|
value | BigDecimal from JCO |
decimal | customized number of decimals |
public static BigDecimal adjustCurrencyDecimalPoint(final BigDecimal value, final int decimal)
//package com.java2s; /*/*from ww w.j a v a 2s .c o m*/ * [y] hybris Platform * * Copyright (c) 2000-2014 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */ import java.math.BigDecimal; public class Main { /** * Adjusts the BigDecimal from JCo value to the correct customized one.<br> * * @param value * BigDecimal from JCO * @param decimal * customized number of decimals * @return corrected BigDecimal */ public static BigDecimal adjustCurrencyDecimalPoint(final BigDecimal value, final int decimal) { final long withoutDecimalPoint = value.unscaledValue().longValue(); final BigDecimal newValue = BigDecimal.valueOf(withoutDecimalPoint, decimal); return newValue; } }