I have found this great solution for rounding:
static Double round(Double d, int precise) {
BigDecimal bigDecimal = new BigDecimal(d);
bigDecimal = b
Rounding a double resp Double in itself does not make much sense, as a double datatype cannot be rounded (easily, or at all?).
What you are doing is:
Double d as input and a int precise number of digits behind the seperator.BigDecimal from that d.BigDecimal correctly.double value of that BigDecimal, which has no rounding applied to it anymore.You can go two ways:
BigDecimal that represents the rounded double, and later decide what you do with it.String representing the rounded BigDecimal.Either of those ways will make sense.