BigDecimal to String
In this chapter you will learn:
Convert BigDecimal to String
String toEngineeringString()
Using engineering notation if an exponent is needed.String toPlainString()
Without an exponent field.String toString()
Using scientific notation if an exponent is needed.
import java.math.BigDecimal;
/*from j av a2 s.c o m*/
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:
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » BigDecimal BigInteger