In below code, user will enter firstAmount and secondAmount. Then program will run and do this calculation firstAmount*secondAmount/123 and answer will be in totalAmount variable. Further program will take the totalAmount and do some extra calculations, but before that i want to add extra digits to totalAmount. For example if by calculating totalAmount gets amount something like 23.021 that is okay. But it doesn't have any decimal point i would add that to it, for example if totalAmount gets amount 41 now there is no decimal point so i would add .00 means after that toalAmount will be 4.00. How do i do that ? How can i add extra digits if there is no already? Below is my code where i want this stuff to be happen.
switch (spinner.getSelectedItemPosition()){
case 0:
{
totalAmount = firstAmount.multiply(secondAmount).divide(new BigDecimal("123"), MathContext.DECIMAL128);
// before next calculation i want to add extra digits if there is no decimal point in the totalAmount
nextCalculation = String.valueOf(totalAmount);
break;
}