VOOZH about

URL: https://www.geeksforgeeks.org/java/bigdecimal-precision-method-in-java/

⇱ BigDecimal precision() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

BigDecimal precision() Method in Java

Last Updated : 4 Dec, 2018
The java.math.BigDecimal.precision() method returns the precision of this BigDecimal. The precision refers to the number of digits in the unscaled value. Syntax:
public int precision()
Parameters: This method does not accept any parameters. Return Value: This method returns an integer which denotes the precision of this BigDecimal object. Examples:
Input : 198.176
Output : 6

Input : 721111.111
Output : 9
Below programs illustrate the java.math.BigDecimal.precision() function in Java: Program 1:
Output:
The precision of 198.176 is 6
The precision of 721111.111 is 9
Program 2:
Comment