1. Math类
| 方法名 | 说明 |
| public static int abs(int a) | 获取参数a的绝对值: |
| public static double ceil(double a) | 向上取整 |
| public static double floor(double a) | 向下取整 |
| public static double pow(double a, double b) | 获取a的b次幂 |
| public static long round(double a) | 四舍五入取整 |
System.out.println("向上取整:"+Math.ceil(13.4)); //14.0
System.out.println("向上取整:"+Math.ceil(-11.8)); //-11.0
System.out.println("向下取整:"+Math.floor(15.9)); //15.0
System.out.println("向下取整:"+Math.floor(-12.6)); //-13.0
System.out.println("2的8次幂:" + Math.pow(2, 8));//256.0
System.out.println("四舍五入 = "+Math.round(12.1)); //12
System.out.println("四舍五入 = "+Math.round(12.8)); //13
System.out.println(Math.random()); //[0.0 , 1.0)
System.out.println((int)(Math.random()*10+1)); //[1,11)

2. System类
常用API方法:
public static native long currentTimeMillis();
public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
public static void exit(int status)
public static void setOut(Prin
浙公网安备 33010602011771号