摘要: package com.huang.algorithm; /** * 面向对象思想实现篮子物品交换 */ public class Demo04 { public static void main(String[] args) { Basket basket1 = new Basket("篮子1") 阅读全文
posted @ 2024-03-11 17:13 晚暮听灯 阅读(27) 评论(0) 推荐(0) 编辑
摘要: //判断整数是不是2的阶次方 public static boolean check(int sum) { boolean flag = true; // 判断标志 while (sum > 1) { if (sum % 2 == 0) { sum = sum/2; } else { flag = 阅读全文
posted @ 2024-03-11 16:48 晚暮听灯 阅读(7) 评论(0) 推荐(0) 编辑
摘要: public static int[] srand(int[] a) { for (int i = 0; i < a.length; i++) { // 随机获取下标 int tmp = (int)(Math.random()*(a.length - i)); // 将此时a[a.length - 阅读全文
posted @ 2024-03-11 16:47 晚暮听灯 阅读(35) 评论(0) 推荐(0) 编辑
摘要: // 定义一周的中文名称 public static String[] week = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; // 定义平年每月天数 public static int[] monthday1 ={0,31,28,31,3 阅读全文
posted @ 2024-03-11 16:35 晚暮听灯 阅读(4) 评论(0) 推荐(0) 编辑