比如123456,小数位数为3,将数变成小数显示为123.456
public static void test1(){
int a = 10023;
int b=6;
double c = a/Math.pow(10,b);
System.out.println(c);
}
Math.pow(a,b)表示以a为底的b次方
比如123456,小数位数为3,将数变成小数显示为123.456
public static void test1(){
int a = 10023;
int b=6;
double c = a/Math.pow(10,b);
System.out.println(c);
}
Math.pow(a,b)表示以a为底的b次方