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