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) {

        // initializing sorted int array
        int intArr[] = { 10, 20, 25, 32, 55 };

        // value to search
        int searchVal = 32;

        int retVal = Arrays.binarySearch(intArr, searchVal);

        System.out.println("The index of element 32 is : " + retVal);
    }
}