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[] argv) {
        String[] sortedArray = new String[] { "a", "b", "c", "d" };

        int index = Arrays.binarySearch(sortedArray, "c");

        index = Arrays.binarySearch(sortedArray, "e");

        int[] sortedIntArray = new int[] { 1, 2, 3, 5, 7 };

        index = Arrays.binarySearch(sortedIntArray, 6);
    }
}