Need help: How to round numbers in java

Hi, i need help with rounding numbers. I want to know how would i round a value of type double to 6 decimal place.

Thank you
Jay

Hi, i’ve had a look at the class but i still have no clue on how to format (type double) numbers.

can you please explain to me.

thanks

Take a peek at DecimalFormat

One example:

import java.text.*;

public class RoundNums {
    public static void main (String args[]) {

    double amount = 4.657;
    DecimalFormat df = new DecimalFormat("##.## ");
    System.out.println(df.format(amount));


    }
}

Thank you for all you help