Hi all, I have a Double with this value 136546.215454 and I want to convert it to: 136546.21 How can I do that (Only 2 decimals after ".")
BigDecimal roundfinalPrice = new BigDecimal(finalPrice.doubleValue()).setScale(2,BigDecimal.ROUND_HALF_UP);
Double doublePrice= new Double(roundfinalPrice.doubleValue());
Ok thanks, I proved it with a number like this 123.1234 and it works fine (y) but when you have a Double like this: 1.2223233545123E10 and apply what you said it return the same value: 1.2223233545123E10, how I can solved that??
+-java.text.DecimalFormat class for all kinds of decimal formatting and other similar classes for toher types of formatting. they are all in java.text.package.