DecimalFormat df = new DecimalFormat("0.00");
String myFormattedFloat = df.format(myFloat);
import java.text.DecimalFormat;
public class code{
public static void main(String[] args){
double area= 12.21564315;
DecimalFormat df = new DecimalFormat("0.0000");
System.out.println("A="+df.format(area));
}
}
total = (double) 100 / listMember.size();
DecimalFormat df = new DecimalFormat("#.##");
String dx = df.format(total);
total = Double.valueOf(dx);