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));
}
}