siledh
0
Q:

java setroundingmode

import java.text.DecimalFormat; 
import java.math.RoundingMode; 

DecimalFormat df = new DecimalFormat();

//Set the rounding mode as CEILING
df.setRoundingMode(RoundingMode.CEILING);

//Set the rounding mode as DOWN
df.setRoundingMode(RoundingMode.DOWN);

//Set the rounding mode as FLOOR
df.setRoundingMode(RoundingMode.FLOOR);

//Set the rounding mode as HALF_DOWN
df.setRoundingMode(RoundingMode.HALF_DOWN);

//Set the rounding mode as HALF_EVEN
df.setRoundingMode(RoundingMode.HALF_EVEN);

//Set the rounding mode as HALF_UP
df.setRoundingMode(RoundingMode.HALF_UP);

//Set the rounding mode as UNNECESSARY
df.setRoundingMode(RoundingMode.UNNECESSARY);

//Set the rounding mode as UP
df.setRoundingMode(RoundingMode.UP);
0

New to Communities?

Join the community