Posted By

mouseroot on 11/14/10


Tagged


Versions (?)

Decimalformat to format decimal points


 / Published in: Java
 

Use this small snippet to change doubles from 123.1234567890 to whatever you wish

  1. import java.text.*;
  2.  
  3. DecimalFormat fmt = new DecimalFormat("$0.00");
  4.  
  5. double test = 1337.09879475398758784;
  6. System.out.println("Fixed Double: " + fmt.format(test));

Report this snippet  

You need to login to post a comment.