The java.math.BigDecimal.toEngineeringString() method is used to represent the current BigDecimal by which this method is called into String form by using engineering notation if an exponent is needed. The string representation of the BigDecimal is the same as described in the toString() method, except that if exponential notation is used, the power of ten is adjusted to be a multiple of three (engineering notation) such that the integer part of nonzero values will be in the range 1 through 999.
public String toEngineeringString()
Parameter: This method do not accepts any parameter.
Return value: This method returns the Engineering String representation of this BigDecimal number.
Below programs illustrates the use of toEngineeringString() method in java
Example 1: Example to convert BigDecimal into Engineering String without exponent notation
Example 2: Example to convert BigDecimal into Engineering String with exponent notation
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.