-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumberOne.java
More file actions
55 lines (49 loc) · 1.71 KB
/
NumberOne.java
File metadata and controls
55 lines (49 loc) · 1.71 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
import java.util.Scanner;
import java.util.*;
public class NumberOne {
public static void main(String[] args) {
String[] str = {"Spiderman", "Avenger", "Superman", "Hulk", "Tony", "Sherlock"};
String smart = "Sherlock";
String big = "Hulk"
String some = "BlackWidow"
check(str, smart);
check(str, big);
check(str, some);
}
public static void check(String[] arr, String targetValue) {
//boolean contains = Arrays.asList(arr).contains(targetValue);
String cont, cons2;
cont = " = true";
cons2 = " = false";
if (Arrays.asList(arr[0]).contains(targetValue)) {
System.out.println(arr[0] + cont);
} else {
System.out.println(arr[0] + cons2);
}
if (Arrays.asList(arr[1]).contains(targetValue)){
System.out.println(arr[1] + cont);
}else {
System.out.println(arr[1] + cons2);
}
if (Arrays.asList(arr[2]).contains(targetValue)){
System.out.println(arr[2] + cont);
}else {
System.out.println(arr[2] + cons2);
}
if (Arrays.asList(arr[3]).contains(targetValue)){
System.out.println(arr[3] + cont);
}else {
System.out.println(arr[3] + cons2);
}
if (Arrays.asList(arr[4]).contains(targetValue)){
System.out.println(arr[4] + cont);
}else {
System.out.println(arr[4] + cons2);
}
if (Arrays.asList(arr[5]).contains(targetValue)){
System.out.println(arr[5] + cont);
}else {
System.out.println(arr[5] + cons2);
}
}
}