package com.gpe.ukweb.invoice;
import java.math.BigDecimal;
public class FormatNumber {
public FormatNumber(){}
public static double Double(String d,int i){
BigDecimal b = new BigDecimal(d);
BigDecimal one = new BigDecimal("1");
return b.divide(one,i,BigDecimal.ROUND_HALF_UP).doubleValue();
}
public static double Double(double d){
return Double(Double.toString(d),2);
}
public static String strDouble(String d,int i){
BigDecimal b = new BigDecimal(d);
BigDecimal one = new BigDecimal("1");
return b.divide(one,i,BigDecimal.ROUND_HALF_UP).toString();
}
public static String strDouble(double d){
return strDouble(Double.toString(d),2);
}
public static void main(String[] args){
String ss="523.9999";
System.out.println(FormatNumber.strDouble(ss,6));
}
}