Remove the trailing zeros

ReturnMethodSummary
BigDecimalstripTrailingZeros()trailing zeros removed.

import java.math.BigDecimal;
 

public class Main {
 
    public static void main(String[] args) {
        BigDecimal first = new BigDecimal(100000f);
        
        System.out.println(first.stripTrailingZeros());
    }
}

The output:


1E+5
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.