Convert BigDecimal to String

ReturnMethodSummary
StringtoEngineeringString()Using engineering notation if an exponent is needed.
StringtoPlainString()Without an exponent field.
StringtoString()Using scientific notation if an exponent is needed.

import java.math.BigDecimal;
 

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

The output:


100000
100000
100000
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.