0

What to do if I want 3 digits after point in a Floating point number?

If Float amt=1243343.43214; Then I want the value of amt as 1243343.432

Riya
  • 71
  • 1
  • 14

1 Answers1

2

Look How to round a number to n decimal places in Java

    Float amt = 1243343.43214f;
    DecimalFormat df = new DecimalFormat("#.###");

    System.out.println(df.format(amt));
Abhishek
  • 3,348
  • 3
  • 15
  • 34