- 博客(4)
- 收藏
- 关注
原创 查找数组中最小值和最大值
public static void main(String[] args) { arr = new int[]{10,2,3,-1,109,6,7,0,9,99}; //查找数组中元素的最大值和最小值 //定义最小值下标 int minIndex = 0; //定义最大值下标 int maxIndex = 0; for (int i = 0; i < arr.length; ..
2021-08-21 10:17:14
402
原创 java实现三分钟倒计时
/**倒计时3分钟 * 03:00 * 02:59 * ... * 00:01*/ public class Countdown { public static void main(String[] args) throws InterruptedException { //创建Date日期对象 Date date = new Date(); //创建日期格式化对象 SimpleDateFormat sdf = new S.
2021-08-20 19:56:00
616
原创 冒泡排序
/**冒泡排序*/ public class BubbleSort { public static void main(String[] args) { //定义交换变量 int swap = 0; //定义数组 int[] arrs = {9,1,3,12,34,78,15,25,2,8}; //外层控制循环趟数 for (int i = 0; i <arrs.length-1 ; i++) {.
2021-08-20 10:53:40
53
原创 随机获得字符串的下标数
自学java public static void main(String[] args) { String s = "asdfghhjjkk12345678"; for(int i = 0; i<s.length();i++) { Random random = new Random(); int index = random.nextInt(s.length()); ...
2021-08-19 13:12:08
151
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人