在JAVA中完成

sag*_*arg 0 java

我想为ex取一个值:

12.166666 ----> 12.00

12.49999 ----> 12.00

12.5111 ----> 13.00

12.9999 ----> 13.00

我想要完成50个paise.

npi*_*nti 9

你可以看看这个Math.round(double a)方法.

System.out.println(Math.round(12.51));//Yields 13
System.out.println(Math.round(12.49));//Yields 12
System.out.println(Math.round(12.50));//Yields 13
Run Code Online (Sandbox Code Playgroud)