NumberFormat SetMinimumFractionDigits() Example
Sets the minimum number of digits allowed in the fraction portion of a number
NumberFormatclass SetMinimumFractionDigits() method example. This example shows you how to use SetMinimumFractionDigits() method.This method Sets the minimum number of digits allowed in the fraction portion of a number
Here is the code:-
/**
* @Program that Sets the minimum number of digits allowed in the fraction
* portion of a number
* SetMinimumFractionDigits.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
import java.util.*;
public class SetMinimumFractionDigits {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getIntegerInstance();
//Returns the maximum number of digits allowed in the fraction
System.out.println("Minimum number of digits allowed in the integer is: "
+nf.getMinimumFractionDigits());
nf.setMinimumFractionDigits(32);
System.out.println("Minimum number of digits allowed in the integer is: "
+nf.getMinimumFractionDigits());
}
} |
Output of the program:-
Minimum number of digits allowed in the integer is: 0
Minimum number of digits allowed in the integer is: 32 |
|