Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,11 +1,11 @@
String[] haystack = {"Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"};
import java.util.Arrays;
String[] haystack = { "Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"};
OUTERLOOP:
for (String needle : new String[]{"Washington","Bush"}) {
for (int i = 0; i < haystack.length; i++)
if (needle.equals(haystack[i])) {
System.out.println(i + " " + needle);
continue OUTERLOOP;
}
System.out.println(needle + " is not in haystack");
int index = Arrays.binarySearch(haystack, needle);
if (index < 0)
System.out.println(needle + " is not in haystack");
else
System.out.println(index + " " + needle);
}