Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        long longArray[] = { 1L, 2L, 4L, 5L };
        Arrays.sort(longArray);

        long searchValue = 2L;
        System.out.println(Arrays.binarySearch(longArray, searchValue));

        searchValue = 3;
        System.out.println(Arrays.binarySearch(longArray, searchValue));
    }
}