for your first question, use the following.
If you want to round just use
> DecimalFormat:
> import java.text.DecimalFormat;
> public class Rounding {
> public static void main(String[] args) {
> DecimalFormat df = new DecimalFormat("#.00");
> double d = 9.99999999999;
> System.out.println(df.format(d));
> }
> }