BigDecimal toEngineeringString() Method in Java with Examples Last Updated : 03 Jun, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Syntax: 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 Java // Java program to demonstrate // toEngineeringString() method of BigDecimal import java.math.*; class GFG { public static void main(String[] args) { // Creating a BigDecimal object BigDecimal b; // Object of String to hold the number String input = "012345678901234567" + "8901234567890123" + "4567890123456789" + "0123456789012345" + "6789012345678901" + "2345678901234567" + "8901234567890123" + "4567890123456789" + "0123456789012345" + "6789012345678901" + "2345678901234567" + "8901234567890123" + "4567890123456789" + "0123456789012345" + "6789012345678901" + "2345678901234567" + "8901234567890123" + "4554324324362432" + "7674637264783264" + "7832678463726478" + "4635463263453264" + "654632498739473"; // Converting to BigDecimal b = new BigDecimal(input); // Apply toEngineeringString() method String s = b.toEngineeringString(); // Print the result System.out.println(s); } } Output: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234554324324362432767463726478326478326784637264784635463263453264654632498739473 Example 2: Example to convert BigDecimal into Engineering String with exponent notation Java // Java program to demonstrate // toEngineeringString() method of BigDecimal import java.math.*; class GFG { public static void main(String[] args) { // Create a BigDecimal object BigDecimal a = new BigDecimal("4536785E10"); // Create a String object String s; // apply toEngineeringString() method s = a.toEngineeringString(); // print the result System.out.println(s); } } Output: 45.36785E+15 References: https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/math/BigDecimal.html#toEngineeringString() Comment More infoAdvertise with us Next Article Byte toString() method in Java with examples R Rajnis09 Follow Improve Article Tags : Java Java-Functions Java-BigDecimal Practice Tags : Java Similar Reads BigDecimal toString() Method in Java with Examples The java.math.BigDecimal.toString() method is used to represent the current BigDecimal by which this method is called into String form, using scientific notation if an exponent is needed. It is done by following steps: A standard canonical string form of the BigDecimal is created by converting the a 3 min read BigDecimal toPlainString() Method in Java with Examples The java.math.BigDecimal.toPlainString() method is used to represent the current BigDecimal by which this method is called into String form without an exponent field. If the values are with a positive scale, the number of digits to the right of the decimal point is used to indicate scale. For values 2 min read DecimalStyle toString() method in Java with Example The toString() method of java.time.format.DecimalStyle class in Java is used to get the String value of this DecimalStyle. This method returns a String representing the String value. Syntax: public String toString() Parameter: This method do not accept any parameter. Return Value: This method return 1 min read Byte toString() method in Java with examples The toString() method of Byte class is a built in method in Java which is used to return a String value. public String toString() Syntax: ByteObject.toString() Return Value: It returns a String object, the value of which is equal to the value of the ByteObject. Below is the implementation of toStrin 2 min read DecimalFormatSymbols toString() method in Java with Examples The toString() method of java.text.DecimalFormatSymbols class in Java is used to get the String value of this DecimalFormatSymbols. This method returns an integer representing the String value. Syntax: public String toString() Parameter: This method do not accept any parameter. Return Value: This me 1 min read Charset toString() method in Java with Examples The toString() method is a built-in method of the java.nio.charset returns a string which describes the charset involved. Syntax: public final String toString() Parameters: The function does not accepts any parameter. Return Value: The function returns a string describing this charset. Below is the 1 min read Like