-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest01.java
More file actions
76 lines (66 loc) · 1.9 KB
/
Test01.java
File metadata and controls
76 lines (66 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package QMcourse;
import java.util.Random;
/**
* @Description: Test01
* @Author:
* @Date: 2020-06-15
* @Version:v1.0
*/
public class Test01 {
public static void main(String[] args) {
/*int[] array = new int[10];
array[0] = 1;
array[1] = 2;
array[2] = 3;
array[3] = 4;
array[4] = 5;
int[] arr1 = new int[] { 1, 2, 3 };
int[] arr2 = new int[] { 1, 2, 3 };
int[] arr3 = new int[] { 1, 2, 3, 4 };
int[] arr4 = null;
System.out.println(isEqual(arr1, arr1)); // true
System.out.println(isEqual(arr1, arr2)); // true
System.out.println(isEqual(arr1, arr3)); // false
System.out.println(isEqual(arr1, arr4)); // false*/
/*int[] a = {0, 12, 2, 3};
int[] output = doSome(a, 3);
for (int i:output) {
System.out.print(i + " ");
}*/
/*Integer num = new Integer(100);
int num2 = num.intValue();*/
try {
Random random = new Random();
int a = random.nextInt(13) + 1;
double b = random.nextDouble() + 4.0;
System.out.println(a);
System.out.println(b);
} finally {
System.out.println();
}
}
public static boolean isEqual(int[] ar1, int[] ar2){
if (ar1 == null || ar2 == null) {
return false;
}
if (ar1.length != ar2.length){
return false;
}
for (int i = 0; i < ar1.length; i++) {
if (ar1[i] != ar2[i]) {
return false;
}
}
return true;
}
public static int[] doSome(int[] input, int n){
int[] output = new int[input.length * n];
for (int i = 0; i < input.length; i++) {
for (int j = 0; j < n; j++) {
output[i * n + j] = input[i];
}
}
return output;
}
}
//1111111