Java DecimalFormat .setMaximumIntegerDigits (int newValue)
Syntax
DecimalFormat.setMaximumIntegerDigits(int newValue) has the following syntax.
public void setMaximumIntegerDigits(int newValue)
Example
In the following code shows how to use DecimalFormat.setMaximumIntegerDigits(int newValue) method.
import java.text.DecimalFormat;
//from ww w .ja v a 2s.c o m
public class Main {
public static void main(String[] argv) throws Exception {
DecimalFormat format = new DecimalFormat();
format.setMaximumFractionDigits(4);
System.out.println(format.format(123456789.12345678));
}
}
The code above generates the following result.