Java DecimalFormat .setRoundingMode (RoundingMode roundingMode)
Syntax
DecimalFormat.setRoundingMode(RoundingMode roundingMode) has the following syntax.
public void setRoundingMode(RoundingMode roundingMode)
Example
In the following code shows how to use DecimalFormat.setRoundingMode(RoundingMode roundingMode) method.
//from w ww . ja v a2 s . co m
import java.math.RoundingMode;
import java.text.DecimalFormat;
public class Main {
public static void main(String[] argv) throws Exception {
DecimalFormat format = new DecimalFormat();
format.setRoundingMode(RoundingMode.CEILING);
System.out.println(format.format(123456789123.45678));
}
}
The code above generates the following result.