xerga 2 年 前
コミット
d3fc757bde
32 ファイル変更868 行追加0 行削除
  1. 1 0
      JavaSE/.idea/modules.xml
  2. 6 0
      JavaSE/.idea/vcs.xml
  3. 11 0
      JavaSE/day05/day05.iml
  4. 26 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr01.java
  5. 18 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr02.java
  6. 31 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr03.java
  7. 31 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr04.java
  8. 28 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr05.java
  9. 16 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr06.java
  10. 11 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test03ArrArea01.java
  11. 16 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test03ArrArea02.java
  12. 17 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test03ArrArea03.java
  13. 50 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test04ArrSuanFa01.java
  14. 30 0
      JavaSE/day05/src/com/lovcoding/day05/arr/Test04ArrSuanFa02.java
  15. 77 0
      JavaSE/day05/src/com/lovcoding/day05/arrex/Test01.java
  16. 33 0
      JavaSE/day05/src/com/lovcoding/day05/arrex/Test02.java
  17. 72 0
      JavaSE/day05/src/com/lovcoding/day05/homework/Test05.java
  18. 11 0
      JavaSE/day06/day06.iml
  19. 30 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr01.java
  20. 30 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr02_Max.java
  21. 25 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr02_Search01.java
  22. 32 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr02_Search02.java
  23. 33 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr02_Search02_1.java
  24. 22 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr03_Revers.java
  25. 21 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr03_Revers_2.java
  26. 23 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr03_Revers_3.java
  27. 32 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr04_Sort_1.java
  28. 27 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr04_Sort_2.java
  29. 37 0
      JavaSE/day06/src/com/lovcoding/day06/TestArr04_Sort_3.java
  30. 11 0
      JavaSE/day08/day08.iml
  31. 60 0
      JavaSE/day08/src/com/lovecoding/day08/Test.java
  32. BIN
      JavaSE/out/production/day08/com/lovecoding/day08/Test.class

+ 1 - 0
JavaSE/.idea/modules.xml

@@ -8,6 +8,7 @@
       <module fileurl="file://$PROJECT_DIR$/day03/day03.iml" filepath="$PROJECT_DIR$/day03/day03.iml" />
       <module fileurl="file://$PROJECT_DIR$/day04/day04.iml" filepath="$PROJECT_DIR$/day04/day04.iml" />
       <module fileurl="file://$PROJECT_DIR$/day07/day07.iml" filepath="$PROJECT_DIR$/day07/day07.iml" />
+      <module fileurl="file://$PROJECT_DIR$/day08/day08.iml" filepath="$PROJECT_DIR$/day08/day08.iml" />
     </modules>
   </component>
 </project>

+ 6 - 0
JavaSE/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+  </component>
+</project>

+ 11 - 0
JavaSE/day05/day05.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 26 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr01.java

@@ -0,0 +1,26 @@
+package com.lovcoding.day05.arr;
+
+public class Test01Arr01 {
+    //数组声明
+    public static void main(String[] args) {
+        //方式1
+        String[] strs;
+
+        //方式2
+        String  strs1[];
+
+        int[]  ints;
+
+        int[]  ints1[];
+
+        //班级人员名称
+        String[] studentNames ;
+
+        //身高
+        double[] heights ;
+
+        //年龄
+        int[] ages;
+
+    }
+}

+ 18 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr02.java

@@ -0,0 +1,18 @@
+package com.lovcoding.day05.arr;
+
+public class Test01Arr02 {
+    //数组声明
+    public static void main(String[] args) {
+
+
+        //班级人员名称
+        String[] studentNames = new String[]{"zs","ls","ww"} ;
+
+        //studentNames = {"zs"}; //错误写法
+        //身高
+        double[] heights = {1.76,1.8,1.62} ;
+        //年龄
+        int[] ages = {18,22,17};
+
+    }
+}

+ 31 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr03.java

@@ -0,0 +1,31 @@
+package com.lovcoding.day05.arr;
+
+public class Test01Arr03 {
+    //数组声明
+    public static void main(String[] args) {
+
+        //班级人员名称
+        String[] studentNames = new String[]{"zs","ls","ww"} ;
+        //身高
+        double[] heights = {1.76,1.8,1.62} ;
+        //年龄
+        int[] ages = {18,22,17};
+
+        //索引设置
+        studentNames[0] = "zkk";
+        heights[0] = 1.86;
+        ages[0] = (++ages[0]);
+
+        //通过索引获取元素
+        System.out.println("第一个人的姓名="+studentNames[0]);
+        System.out.println("第一个人的身高="+heights[0]);
+        System.out.println("第一个人的年龄="+ages[0]);
+
+        //长度
+        int length = studentNames.length; //获取长度之后 返回int 需要定义int类型变量去接收
+        System.out.println(length);
+
+        //数组
+        System.out.println(studentNames);
+    }
+}

+ 31 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr04.java

@@ -0,0 +1,31 @@
+package com.lovcoding.day05.arr;
+
+public class Test01Arr04 {
+    //数组声明
+    public static void main(String[] args) {
+
+        //班级人员名称
+        String[] studentNames = new String[]{"zs","ls","ww"} ;
+        //身高
+        double[] heights = {1.76,1.8,1.62} ;
+        //年龄
+        int[] ages = {18,22,17};
+
+        //遍历改变身高
+        //i = 索引
+        //heights.length -1 = 最大索引  使用的是 < 索引不用-1
+        for (int i = 0; i < heights.length; i++) {
+            heights[i]+=0.1; //每个人+0.1
+        }
+
+        //查看
+        for (int i = 0; i < heights.length; i++) {
+            System.out.println(heights[i]);
+        }
+
+        //班级人员名称 增强for
+        for (String studentName : studentNames) {
+            System.out.println(studentName);
+        }
+    }
+}

+ 28 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr05.java

@@ -0,0 +1,28 @@
+package com.lovcoding.day05.arr;
+
+public class Test01Arr05 {
+    //数组声明
+    public static void main(String[] args) {
+
+        //班级人员名称 动态初始化
+        String[] names = new String[5];
+
+        //默认值
+        System.out.println(names[0]);
+
+        System.out.println("----------");
+        //赋值
+        names[0] = "kk";
+        names[1] = "ff";
+        names[2] = "xx";
+        
+        //遍历
+        for (int i = 0; i < names.length; i++) {
+            System.out.println(names[i]);
+        }
+
+
+        int[] arr1 = new int[1];
+        System.out.println(arr1[0]);
+    }
+}

+ 16 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test01Arr06.java

@@ -0,0 +1,16 @@
+package com.lovcoding.day05.arr;
+
+public class Test01Arr06 {
+    //数组声明
+    public static void main(String[] args) {
+
+        //班级人员名称 动态初始化
+        String[] names = new String[5];
+
+        //数组越界 元素5个
+        //访问的是第6个元素
+        //出现越界异常
+        // ArrayIndexOutOfBoundsException 通过索引访问不到元素
+        System.out.println(names[5]);
+    }
+}

+ 11 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test03ArrArea01.java

@@ -0,0 +1,11 @@
+package com.lovcoding.day05.arr;
+
+public class Test03ArrArea01 {
+    //数组内存
+    public static void main(String[] args) {
+        //创建数组
+        int[] arr = new int[3];
+
+        System.out.println(arr);
+    }
+}

+ 16 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test03ArrArea02.java

@@ -0,0 +1,16 @@
+package com.lovcoding.day05.arr;
+
+public class Test03ArrArea02 {
+    //数组内存
+    public static void main(String[] args) {
+        //创建数组
+        int[] arr1 = new int[3];
+        //设置值
+        arr1[1] = 10;
+        System.out.println(arr1);
+
+        int[] arr2 = new int[3];
+        arr2[0] = 5;
+        System.out.println(arr2);
+    }
+}

+ 17 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test03ArrArea03.java

@@ -0,0 +1,17 @@
+package com.lovcoding.day05.arr;
+
+public class Test03ArrArea03 {
+    //数组内存
+    public static void main(String[] args) {
+        //创建数组
+        int[] arr1 = new int[3];
+        //设置值
+        arr1[1] = 10;
+        System.out.println(arr1[1]);
+
+        int[] arr2 = arr1;
+        arr2[1] = 20;
+
+        System.out.println(arr1[1]); // 输出 ??  20
+    }
+}

+ 50 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test04ArrSuanFa01.java

@@ -0,0 +1,50 @@
+package com.lovcoding.day05.arr;
+
+public class Test04ArrSuanFa01 {
+
+    public static void main(String[] args) {
+        //求平均值
+        int[] arr = {10,23,34,56,61,23,102,208};
+
+        //求和
+        double sum = 0;
+
+        for (int i = 0; i < arr.length; i++) {
+            sum+=arr[i];
+        }
+
+        System.out.println(sum/arr.length); //double
+    }
+
+    public static void main2(String[] args) {
+        //统计个数
+        //统计偶数的个数
+        int[] arr = {10,23,34,56,61,23,102,208};
+
+        //统计 出现 ++
+        int count = 0;
+
+        for (int i = 0; i < arr.length; i++) {
+            if ( arr[i] % 2 == 0 ){
+                count++;
+            }
+        }
+
+        System.out.println(count);
+
+    }
+    public static void main1(String[] args) {
+        //求和
+        int[] arr = {10,23,34,56,61,23,102,208};
+
+        //sum
+        int sum = 0;
+
+        //循环相加
+        for (int i = 0; i < arr.length; i++) {
+            sum+=arr[i];
+        }
+
+        System.out.println(sum);
+    }
+}

+ 30 - 0
JavaSE/day05/src/com/lovcoding/day05/arr/Test04ArrSuanFa02.java

@@ -0,0 +1,30 @@
+package com.lovcoding.day05.arr;
+
+import java.util.Random;
+
+public class Test04ArrSuanFa02 {
+
+    public static void main(String[] args) {
+        //求最大值
+        int[] arr = {10,23,34,56,61,23,102,208};
+        //索引
+        int index = 0;
+        //假设
+        int max = arr[0];
+        for (int i = 0; i < arr.length; i++) {
+            //比较
+            if (arr[i] > max){
+                //如果大于max 从新赋值
+                max = arr[i];
+                //记录索引
+                index = i;
+            }
+        }
+        System.out.println("最大值是:"+max+":索引是:"+index); //double
+
+        //产生随机数
+        int v =(int) (Math.random() * 100);  //Math.random() [0-1) 0-0.9999
+
+        System.out.println(v);
+    }
+}

+ 77 - 0
JavaSE/day05/src/com/lovcoding/day05/arrex/Test01.java

@@ -0,0 +1,77 @@
+package com.lovcoding.day05.arrex;
+
+import java.util.Scanner;
+
+public class Test01 {
+    public static void main(String[] args) {
+        //已知平年12个月每个月的总天数是{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,31},
+        // 从键盘输入年,月,日后,计算这一天是这一年的第几天。提示:考虑闰年
+        //考虑输入合法行
+        Scanner scanner = new Scanner(System.in);
+        System.out.println("年");
+        int year;
+        while (true){
+            year = scanner.nextInt();
+            if (year > 2022){
+                break;
+            }else{
+                System.out.println("请输入大于2022的年份");
+            }
+        }
+
+        System.out.println("月");
+        int month;
+        while (true){
+            month = scanner.nextInt();
+            if (month >= 0 && month <=12 ){
+                break;
+            }else{
+                System.out.println("请输入合法的月份");
+            }
+        }
+
+        //根据月份设置天数
+        int monthOfDays;
+        if (month == 2){
+            if( year % 4 == 0 && year % 400 == 0 || year % 100 == 0){
+                monthOfDays = 29;
+            }else{
+                monthOfDays = 28;
+            }
+        }else if( month == 4 || month == 6 || month == 8 || month == 11){
+            monthOfDays = 30;
+        }else{
+            monthOfDays = 31;
+        }
+
+        System.out.println("日");
+        int day;
+        while (true){
+            day = scanner.nextInt();
+            if ( day <= 0 ){
+                System.out.println("日期大于0");
+            }else if (day > monthOfDays){
+                System.out.println(year+"年"+month+"月 ,只有"+monthOfDays+"天");
+            }else{
+                break;
+            }
+        }
+
+        int days = 0;
+        //月份 数组
+        int[] ms = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,31};
+        //判断闰年
+        if( year % 4 == 0 && year % 400 == 0 || year % 100 == 0){
+            days++;
+        }
+        //根据月份 天数
+        for (int i = 0; i < month-1 ; i++) {
+            days+= ms[i];
+        }
+        //天数+
+        days+=day;
+
+        System.out.println("days="+days);
+
+    }
+}

+ 33 - 0
JavaSE/day05/src/com/lovcoding/day05/arrex/Test02.java

@@ -0,0 +1,33 @@
+package com.lovcoding.day05.arrex;
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+public class Test02 {
+    public static void main(String[] args) {
+        //用一个数组存储本组学员的姓名,先从键盘输入小组人数,再从键盘输入每一个学员的姓名,然后遍历显示。
+        //键盘输入每一个学员的姓名:输入次数 = 数组长度 。 循环次数。
+        //循环输入5次。
+        //scanner.next() 输入名称。
+        Scanner scanner = new Scanner(System.in);
+
+        System.out.println("请输入学生人数");
+        int number = scanner.nextInt();
+        //创建
+        String[] names = new String[number];
+        //循环赋值
+        for (int i = 0; i < names.length; i++) {
+            //请输入
+            System.out.println("请输入第"+(i+1)+"个人的名字");
+            names[i] = scanner.next();
+        }
+
+        //工具类
+        System.out.println(Arrays.toString(names));
+
+        //遍历数组
+        for (int i = 0; i < names.length; i++) {
+            System.out.println(names[i]);
+        }
+    }
+}

+ 72 - 0
JavaSE/day05/src/com/lovcoding/day05/homework/Test05.java

@@ -0,0 +1,72 @@
+package com.lovcoding.day05.homework;
+
+public class Test05 {
+    //定义变量week赋值为上一年12月31日的星期值(可以通过查询日历获取),定义变量year、month、day,
+    // 分别赋值任意年日期年、月、日值。计算今天是星期几。
+    public static void main(String[] args) {
+        //week = 6
+        int week = 6;
+
+        int year = 2024;
+        int month = 1;
+        int day = 15;
+
+        //求和
+        int days = 0;
+        days += day;
+
+        //年份天数
+        for (int i = 2022; i < year-1 ; i++) {
+            //整年的天数
+            days+=365;
+            //闰年
+            if (year % 4 == 0 && year % 400 == 0 || year % 100 ==0){
+                days++;
+            }
+        }
+
+        //月份天数
+        for (int i = 1; i < month; i++) {
+            //30天  28天  29天 31天
+            if( i == 4 || i == 6 || i == 9 || i ==11 ){
+                days+=30;
+            }else if ( i == 2){
+                days+=28;
+                if (year % 4 == 0 && year % 400 == 0 || year % 100 ==0){
+                    days++;
+                }
+            }else{
+                days+=31;
+            }
+        }
+
+        //总天数 + week 对 7 取模  最后是星期几?
+
+        days = days + week;
+
+        switch (days%7){
+            case 1:
+                System.out.println("星期1");
+                break;
+            case 2:
+                System.out.println("星期2");
+                break;
+            case 3:
+                System.out.println("星期3");
+                break;
+            case 4:
+                System.out.println("星期4");
+                break;
+            case 5:
+                System.out.println("星期5");
+                break;
+            case 6:
+                System.out.println("星期6");
+                break;
+            case 7:
+                System.out.println("星期日");
+                break;
+        }
+
+    }
+}

+ 11 - 0
JavaSE/day06/day06.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 30 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr01.java

@@ -0,0 +1,30 @@
+package com.lovcoding.day06;
+
+public class TestArr01 {
+
+    //查找多个最大值
+    public static void main(String[] args) {
+        int[] arr = {1,2,5,7,13,67,99,99,23,99};
+        //出现三个最大值 99
+        //返回索引
+        //第一步 找出最大值
+        int max = arr[0];
+
+        for (int i = 0; i < arr.length; i++) {
+            if (max < arr[i]){
+                max = arr[i];
+            }
+        }
+        System.out.println(max);
+        //第二步 查找索引
+        //依次比较
+        String index ="[";
+        for (int i = 0; i < arr.length; i++) {
+            if (arr[i] == max){
+                index += i +",";
+            }
+        }
+        index+="]";
+        System.out.println(index);
+    }
+}

+ 30 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr02_Max.java

@@ -0,0 +1,30 @@
+package com.lovcoding.day06;
+
+public class TestArr02_Max {
+
+    //查找多个最大值
+    public static void main(String[] args) {
+        int[] arr = {1,2,5,7,13,67,99,99,23,99};
+
+        //优化
+        int max = arr[0];
+
+        //索引
+        String index = "";
+
+        //循环
+        for (int i = 0; i < arr.length; i++) {
+            if ( arr[i] > max ){
+                max = arr[i];
+                //索引
+                index = i+"";
+            }else if (max == arr[i]){
+                index += " , "+ i;
+            }
+        }
+
+        System.out.println("最大值"+max);
+        System.out.println("索引"+index);
+
+    }
+}

+ 25 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr02_Search01.java

@@ -0,0 +1,25 @@
+package com.lovcoding.day06;
+
+public class TestArr02_Search01 {
+
+    //查找多个最大值
+    public static void main(String[] args) {
+        int[] arr = {1,2,5,7,13,67,99,99,23,99};
+
+        //普通查找
+        int a = 13;
+
+        //索引
+        int index = -1;
+
+        for (int i = 0; i < arr.length; i++) {
+            if (a == arr[i]){
+                index = i;
+                break;
+            }
+        }
+
+        System.out.println(index);
+        System.out.println(arr[index]);
+    }
+}

+ 32 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr02_Search02.java

@@ -0,0 +1,32 @@
+package com.lovcoding.day06;
+
+import java.util.Scanner;
+
+public class TestArr02_Search02 {
+
+    //查找多个最大值
+    public static void main(String[] args) {
+        Scanner scanner = new Scanner(System.in);
+        System.out.println("请输入查找的值");
+        int target = scanner.nextInt();
+
+        int[] arr = {1,3,5,6,8,9,11,14,16,18,19,22,25,27,28,29,35,46,57,67,78,98};
+        //mid left right
+        int left = 0;
+        int right = arr.length-1;
+
+        while (true){
+            int mid = (left + right) /2;
+            //比较
+            if ( arr[mid] > target  ){
+                right = mid - 1;
+            }else if (arr[mid] < target){
+                left = mid+1;
+            }else{
+                System.out.println("索引="+mid);
+                break;
+            }
+        }
+
+    }
+}

+ 33 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr02_Search02_1.java

@@ -0,0 +1,33 @@
+package com.lovcoding.day06;
+
+import java.util.Scanner;
+
+public class TestArr02_Search02_1 {
+
+    //查找多个最大值
+    public static void main(String[] args) {
+        Scanner scanner = new Scanner(System.in);
+        System.out.println("请输入查找的值");
+        int target = scanner.nextInt();
+
+        int[] arr = {1,3,5,6,8,9,11,14,16,18,19,22,25,27,28,29,35,46,57,67,78,98};
+        //mid left right
+
+        int index = -1;
+        for (int left = 0, right = arr.length-1;  left <= right ; ) {
+            //mid中间值
+            int mid = (left + right )/2;
+            //判断
+            if ( target == arr[mid] ){
+                index = mid;
+                break;
+            }else if (target > arr[mid] ){
+                left = mid+1;
+            }else if (target < arr[mid]){
+                right = mid -1;
+            }
+        }
+
+        System.out.println("索引"+index);
+    }
+}

+ 22 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr03_Revers.java

@@ -0,0 +1,22 @@
+package com.lovcoding.day06;
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+public class TestArr03_Revers {
+    //方式1
+    public static void main(String[] args) {
+
+        int[] arr = {1,3,5,6,8,9,11,14,16,18,19,22,25,27,28,29,35,46,57,67,78,98};
+
+        //反转
+        for (int i = 0; i < arr.length/2; i++) {
+            //交换
+            int temp = arr[i];
+            arr[i] = arr[arr.length-1 -i];
+            arr[arr.length-1 -i] = temp;
+        }
+
+        System.out.println(Arrays.toString(arr));
+    }
+}

+ 21 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr03_Revers_2.java

@@ -0,0 +1,21 @@
+package com.lovcoding.day06;
+
+import java.util.Arrays;
+
+public class TestArr03_Revers_2 {
+    //方式1
+    public static void main(String[] args) {
+
+        int[] arr = {1,3,5,6,8,9,11,14,16,18,19,22,25,27,28,29,35,46,57,67,78,98};
+
+        //反转
+        for (int left = 0 ,right = arr.length -1; left<right; left++ , right--) {
+            //交换
+            int temp = arr[left];
+            arr[left] = arr[right];
+            arr[right] = temp;
+        }
+
+        System.out.println(Arrays.toString(arr));
+    }
+}

+ 23 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr03_Revers_3.java

@@ -0,0 +1,23 @@
+package com.lovcoding.day06;
+
+import java.util.Arrays;
+
+public class TestArr03_Revers_3 {
+    //方式1
+    public static void main(String[] args) {
+        //toCharArray 返回字符数组
+        String str = "helloworld";
+
+        //获取字符数组
+        char[] chars = str.toCharArray();
+
+        //反转
+        for (int i = 0; i < chars.length/2; i++) {
+            char temp = chars[i];
+            chars[i] = chars[chars.length-1-i];
+            chars[chars.length-1-i] = temp;
+        }
+
+        System.out.println(Arrays.toString(chars));
+    }
+}

+ 32 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr04_Sort_1.java

@@ -0,0 +1,32 @@
+package com.lovcoding.day06;
+
+import java.util.Arrays;
+
+public class TestArr04_Sort_1 {
+    //选择排序
+    public static void main(String[] args) {
+        int[] arr = {11,31,53,16,18,29,111,14,716,218,19,22,125,127,28,529,35,46,57,67,78,98};
+
+        //排序
+        for (int i = 0; i < arr.length-1; i++) {
+            //最小值
+            int min = arr[i];
+            //索引
+            int index = i;
+
+            for (int j = i+1; j < arr.length ; j++) {
+                if (arr[j] < min){
+                    min = arr[j];
+                    index = j;
+                }
+            }
+            //判断最小值位置 和 i 是否相等
+            if (index != i){
+                int temp = arr[i];
+                arr[i] = arr[index];
+                arr[index] = temp;
+            }
+        }
+        System.out.println(Arrays.toString(arr));
+    }
+}

+ 27 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr04_Sort_2.java

@@ -0,0 +1,27 @@
+package com.lovcoding.day06;
+
+import java.util.Arrays;
+
+public class TestArr04_Sort_2 {
+    //选择排序
+    public static void main(String[] args) {
+        int[] arr = {11,31,53,16,18,1,1231,123,123,432,5,32,5,435,4326,456,45,1,123,213,213,12,4,21,4,21,4,214,21,4,21,4,21};
+        long start = System.currentTimeMillis();
+
+        for (int i = 1; i < arr.length; i++) {
+            for (int j = 0; j < arr.length-i; j++) {
+                //第一个和第二个比较
+                if (arr[j] > arr[j+1]){
+                    int temp = arr[j];
+                    arr[j] = arr[j+1];
+                    arr[j+1] = temp;
+                }
+            }
+        }
+
+        long end = System.currentTimeMillis();
+        System.out.println(end-start);
+
+        System.out.println(Arrays.toString(arr));
+    }
+}

+ 37 - 0
JavaSE/day06/src/com/lovcoding/day06/TestArr04_Sort_3.java

@@ -0,0 +1,37 @@
+package com.lovcoding.day06;
+
+import java.util.Arrays;
+
+public class TestArr04_Sort_3 {
+    //选择排序
+    public static void main(String[] args) {
+        int[] arr = {11,31,53,16,18,1,1231,123,123,432,5,32,5,435,4326,456,45,1,123,213,213,12,4,21,4,21,4,214,21,4,21,4,21};
+
+        int lun = 0;
+        int count = 0;
+        for (int i = 1; i < arr.length; i++) {
+            lun++;
+            //标识
+            boolean flag = true;
+            for (int j = 0; j < arr.length-i; j++) {
+                count++;
+                //第一个和第二个比较
+                if (arr[j] > arr[j+1]){
+                    int temp = arr[j];
+                    arr[j] = arr[j+1];
+                    arr[j+1] = temp;
+                    //改变状态
+                    flag = false;
+                }
+            }
+            //没有改
+            if (flag){
+                break;
+            }
+        }
+
+        System.out.println(lun);
+        System.out.println(count);
+        System.out.println(Arrays.toString(arr));
+    }
+}

+ 11 - 0
JavaSE/day08/day08.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 60 - 0
JavaSE/day08/src/com/lovecoding/day08/Test.java

@@ -0,0 +1,60 @@
+package com.lovecoding.day08;
+
+public class Test {
+    public static void main(String[] args) {
+
+
+        System.out.println(fn3(9));
+        fn4(12);
+
+    }
+    public static int fn4(int n) {
+
+        int count = 1;
+        for (int i = n; i >=1  ; i--) {
+            count = (count + 1) * 2;
+            System.out.println(count);
+        }
+        return count;
+    }
+    public static int fn3(int n) {
+        if (n == 10){
+            return 1;
+        }
+        return (fn3(n+1)+1)*2;
+    }
+
+    public static int fn2(int n) {
+        if(n<1){//负数是返回特殊值1,表示不计算负数情况
+            return 1;
+        }
+        if(n==1 || n==2){
+            return 1;
+        }
+        return fn2(n-2)+fn2(n-1);
+    }
+
+    public static int fn1(int n) {
+
+        if(n<1){//负数是返回特殊值1,表示不计算负数情况
+            return 1;
+        }
+        if(n==1 || n==2){
+            return 1;
+        }
+        int beforebefore = 1;
+        int before = 1;
+        int now = before + beforebefore;
+
+        for (int i = 4; i <= n; i++) {
+
+            beforebefore = before;
+            before = now;
+
+            now =beforebefore+before;
+
+        }
+
+        return now;
+    }
+}

BIN
JavaSE/out/production/day08/com/lovecoding/day08/Test.class