public class Main {
public static void main(String[] args){
// Round a float value to an Integer//from NowJava.com - 时代Java
System.out.println(roundFloatToInt(new Float("8.837")));
System.out.println(roundDoubleToLong(new Double("9.9")));
}
/**
* Rounds a floating-point number to an Integer and returns the result
* @param myFloat
* @return
*/
public static int roundFloatToInt(float myFloat){
return Math.round(myFloat);
}
/**
* Rounds a Double value to an Integer and returns the result
* @param myDouble
* @return
*/
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。