Número de lugares decimales en Java
package org.arpit.java2blog;
import java.text.DecimalFormat;
public class FormatNumberWithCommaDecimalFormat {
public static void main(String[] args) {
DecimalFormat df=new DecimalFormat("#,###.00");
double d = 2000000;
String formattedNumberWithComma = df.format(d);
System.out.println("Formatted number with commas: "+formattedNumberWithComma);
}
}
Dylan