Skip to content

Commit

Permalink
作业
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunbeam-5 committed May 7, 2022
1 parent 9d7ba9b commit 26a812d
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 20220504/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 20220504/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 20220504/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 20220504/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 20220504/20220504.iml
Original file line number Diff line number Diff line change
@@ -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>
Binary file added 20220504/out/production/20220504/Test.class
Binary file not shown.
Binary file added 20220504/out/production/20220504/Test2.class
Binary file not shown.
Binary file added 20220504/out/production/20220504/Test3.class
Binary file not shown.
Binary file added 20220504/out/production/20220504/Test4.class
Binary file not shown.
14 changes: 14 additions & 0 deletions 20220504/src/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import java.util.Arrays;

public class Test {
public static void transform(int[] array1){
for (int i = 0; i < array1.length; i++) {
array1[i] *= 2;
}
}
public static void main(String[] args) {
int[] array= new int[]{1, 2, 3};
transform(array);
System.out.println(Arrays.toString(array));
}
}
14 changes: 14 additions & 0 deletions 20220504/src/Test2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import java.util.Arrays;

public class Test2 {
public static void initialization(int[] arr){
for (int i = 0; i < arr.length; i++) {
arr[i] = i + 1;
}
}
public static void main(String[] args) {
int[] array = new int[100];
initialization(array);
System.out.println(Arrays.toString(array));
}
}
16 changes: 16 additions & 0 deletions 20220504/src/Test3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.util.Arrays;

public class Test3 {
public static void main(String[] args) {
int[] nums = new int[]{1,3,5,7,9,11};
int target = 20;
for (int i = 0; i < nums.length - 1; i++) {
for (int j = i + 1; j < nums.length; j++) {
if (nums[i] + nums[j] == target){
int[] array = {i, j};
System.out.println(Arrays.toString(array));
}
}
}
}
}
25 changes: 25 additions & 0 deletions 20220504/src/Test4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.Arrays;

public class Test4 {
public static void Bubble_Sort(int[] nums){
for (int i = 0; i < nums.length - 1; i++) {
boolean flg = false;
for (int j = 0; j < nums.length - 1 - i; j++) {
if (nums[j] > nums[j+1]){
int temp = nums[j];
nums[j] = nums[j+1];
nums[j+1] = temp;
flg = true;
}
}
if (flg == false){
return;
}
}
}
public static void main(String[] args) {
int[] array = {7,4,6,2,1,3,5,9,8};
Bubble_Sort(array);
System.out.println(Arrays.toString(array));
}
}
6 changes: 6 additions & 0 deletions 20220504/src/Test5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class Test5 {
public static void main(String[] args) {

System.out.println();
}
}

0 comments on commit 26a812d

Please sign in to comment.