DecimalFormat.setRoundingMode(RoundingMode roundingMode) has the following syntax.
public void setRoundingMode(RoundingMode roundingMode)
In the following code shows how to use DecimalFormat.setRoundingMode(RoundingMode roundingMode) method.
/* ww w.jav a 2 s . c o 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.