NumberFormat.setRoundingMode(RoundingMode roundingMode) has the following syntax.
public void setRoundingMode(RoundingMode roundingMode)
In the following code shows how to use NumberFormat.setRoundingMode(RoundingMode roundingMode) method.
import java.math.RoundingMode; import java.text.NumberFormat; import java.util.Currency; import java.util.Locale; // w w w. j a v a 2 s. c om public class Main { public static void main(String[] args) throws Exception { NumberFormat numberFormat = NumberFormat.getNumberInstance(); numberFormat.setCurrency(Currency.getInstance(Locale.CANADA)); numberFormat.setRoundingMode(RoundingMode.CEILING); } }