I need to format (and not round off) a double to 2 decimal places.
double
I tried with:
String s1 = \"10.126\"; Double f1 = Double.pa
Have you tried RoundingMode.FLOOR?
String s1 = "10.126"; Double f1 = Double.parseDouble(s1); DecimalFormat df = new DecimalFormat(".00"); df.setRoundingMode(RoundingMode.FLOOR); System.out.println("f1"+df.format(f1));