import java.text.* ;
import java.math.* ;
public class Test
{
public Test(){
double a=saveNumber(15.12312312,6);
System.out.println("a....."+a);
}
//保留小数点的位数
//number为要处理的数,digit为要保留的位数
public double saveNumber(double number,int digit){
NumberFormat ddf1=NumberFormat.getNumberInstance();
ddf1.setMaximumFractionDigits(digit);
String s= ddf1.format(number);
double Num=Double.parseDouble(s);
return Num;
}
public static void main(String args[])
{
new Test();
}
}