DecimalFormat SetMinimumIntegerDigits() Example
Sets the minimum number of digits allowed in the integer
DecimalFormatclass SetMinimumIntegerDigits() method example. This example shows you how to use SetMinimumIntegerDigits() method.This method Sets the minimum number of digits allowed in the integer portion of a number.
Here is the code:-
/**
* @Program that Sets the minimum number of digits allowed in the integer
* portion of a number.
* SetMinimumIntegerDigits.java
* Author:-RoseIndia Team
* Date:-13-Jun-2008
*/
import java.text.*;
public class SetMinimumIntegerDigits {
public static void main(String[] args) {
// Creates a DecimalFormat object
DecimalFormat d = new DecimalFormat();
//Gets the minimum number of digits allowed in the integer portion of a number.
System.out.println("The minimum number of digits allowed in the integer portion of a number is: "
+ d.getMinimumIntegerDigits());
//Sets the minimum number of digits allowed in the integer
d.setMinimumIntegerDigits(9);
System.out.println("The minimum number of digits allowed in the integer portion of a number is: "
+ d.getMinimumIntegerDigits());
}
} |
Output of the Program
The minimum number of digits allowed in the integer portion of a number is: 1
The minimum number of digits allowed in the integer portion of a number is: 9 |
|