Вывод в консоль правильный, а код не проходит по 2 и 3 пункту. Кто знает как решить?
public class Solution {
public static int[] array = {9, 8, 7, 6, 5, 4, 3, 2, 1};
public static int element = 5;
public static void main(String[] args) {
//напишите тут ваш код
int index = Arrays.binarySearch(array, element);
if (index == -1) {
System.out.println(false);
} else {
System.out.println(true);
}
}
}package com.javarush.task.pro.task05.task0519;
import java.util.Arrays;
/*
Есть ли кто?
*/
public class Solution {
public static int[] array = {9, 8, 7, 6, 5, 4, 3, 2, 1};
public static int element = 5;
public static void main(String[] args) {
//напишите тут ваш код
int index = Arrays.binarySearch(array, element);
if (index == -1) {
System.out.println(false);
} else {
System.out.println(true);
}
}
}