public static void main(String[] args) {
        double d1 = 17;
        double d2 = 3;
        double result = d1 / d2;
        /**
         * 四舍五入
         */
        int roundNum = (int) Math.round(result);
        /**
         * 向上取整
         */
        int ceilNum = (int) Math.ceil(result);
        /**
         * 向下取整
         */
        int floorNum = (int) Math.floor(result);

        System.out.println("除法商值:" + result);
        System.out.println("四舍五入:" + roundNum);
        System.out.println("向上取整:" + ceilNum);
        System.out.println("向下取整:" + floorNum);


        Integer[] arr = {1, 2, 3, 4, 5};
        List<Integer> list = new ArrayList<Integer>();
        double childNum = 22;
        double colorNum = 5;
        double num = childNum / colorNum;
        System.out.println(num);
        int ceilNum1 = (int) Math.ceil(num);
        System.out.println(ceilNum1);
        for (int i = 0; i < ceilNum1; i++) {
            Collections.addAll(list, arr);
        }
        System.out.println(list);

    }

java 计算除法 java math 除法_System