I have used the following function
float val=0.0;
DecimalFormat toTheFormat = new DecimalFormat("#.##");
float value=Float.valueOf(toTheFormat.format(val));
But its not suitable for all conditions like "0.0" still "0.0". Its not scale up to "0.00".